I have file php that send value in array by query to ajax.
$sql = "SELECT * FROM populasi INNER JOIN waktu ON populasi.idWaktu = waktu.id WHERE waktu.jam = $jam";
$result = $con->query($sql);
$points=array();
foreach ($result as $m) {
$points[] = 'new google.maps.LatLng('.$m[x].', '.$m[y].')';
}
print_r($points);
this ajax will receive a value from php file and I want the value to be a javascript array like "var points". Can you help me how to do it ? Thanks
$.ajax({
type: "POST",
url: "proses.php",
data: {
jam: slider.value,
},
success: function(response){
//example array points
var points = [
new google.maps.LatLng(-7.320339, 112.768071),
new google.maps.LatLng(-7.320233, 112.768446),
];
}
});