I have a JS function that does a ajax GET (datatype: JSON) to a PHP page on the same domain.
I get the JSON response as I can see it via firebug but my success function doesn’t seem to execute.
function getAppointments(){
var url = "http://site.com/quote/appointments/download/";
$.ajax({
type: "GET",
dataType:"json",
url: url,
success: function(data, textStatus, jqXHR)
{
alert('success');
$.each(data,function()
{
var li = $('<li />');
li.val(); //haven't gotten this far yet
li.text();
$('#appointment-list').append(li);
});
}
});
}
I get a 200 OK status in firebug and can see the json objects but my alert(‘success’) doesn’t fire.
Can anyone see why? I’m sure it’s just a little mistake somewhere.
Regards,
Billy
Are you sending the correct headers from PHP? If you are sending JSON you should include:
To tell whatever opens the script that it is JSON.