the following php code that generates two arrays
<?php
//los datos salen de una tabla mysql
$last_year_sales = [2589, 2589, 1478, 2587, 7852, 9632];
$current_year_sales = [1250, 1480, 1156, 3589, 7521, 9632];
//enviar
echo json_encode($last_year_sales);
echo json_encode($current_year_sales);
?>
I need to receive them on another page and I do so
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var last_year = JSON.parse(this.last_year_sales);
var current_year = JSON.parse(this.current_year_sales);
}
This comes
[2589, 2589, 1478, 2587, 7852, 9632][1250, 1480, 1156, 3589, 7521, 9632]
How do I request the two arrays? or how do I do with ajax?
Thank you.