In chrome and safari, the following code works fine.
in firefox, all platforms, all versions, it does not work and throws an error that object is undefined (from jQuery) stopping on the $.each loop
This code calls a json web service via AJAX and returns JSON.
ideas?
CODE
$.ajax({
url: "URL GOES HERE",
data: JSON.stringify({
"geoNear": "geotestnew",
"near": [-73.78086565, 41.014072],
"maxDistance": 0.3
}),
type: "POST",
crossDomain: true,
contentType: "application/json",
success: function(data) {
var usthis = data.results;
$.each(usthis, function(entryIndex, entry) {
var newdis = this.dis * 69;
$("#results").append('<br>');
$("#results").append(newdis);
$("#results").append('<br>');
$("#results").append(this.obj.Name);
$("#results").append('<br>');
});
},
error: function(x, e) {
$('body').html('error: ' + e);
}
});
});
You haven’t set
dataTypein ajax options to let jQuery know what type of response to expecthttp://api.jquery.com/jQuery.ajax/