This question already has an answer here:
I'm not entirely sure if this is possible but I am trying to use an ajax response in a javascript array in my page.
this is what I have:
var interval = 5000;
function doAjax() {
jQuery.ajax({
type: 'POST',
url: 've.php',
dataType : 'json',
success: function (data) {
//var arr = data.split('|');
jQuery('#counterint').html(data);
var res = $.parseJSON(data);
//test: simulated ajax
var testLocs = {
<<<<<<<<<<<<<< I NEED TO USE THE "data" HERE >>>>>>>>>>>>>>>>>
};
setMarkers(testLocs);
The ajax response looks like this when I outputs it on my page in the browser:
1: { info: '1. rooz', lat: 51.5033630, lng: -0.1276250 },2: { info: '1. Rooz555', lat: 51.5033567, lng: -0.1276444 },3: { info: '1. david', lat: 51.5033777, lng: -0.1276777 },4: { info: '1. sam', lat: 51.5033555, lng: -0.1276543 },
any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire