AJAX error when there is no error...
I have the following code in place. This code is part of a Smarty PHP template so some of the elements are going to look a bit funny but I can assure you that it does output to the browser properly.
Anyways, onto what the issue is. For some reason the error function is executing no matter if the AJAX call occurred properly or not. I know that the AJAX call is occurring properly since I can see the reply in FireBug and I see the data results come back from server.
-
function GetIMStatus() {
$("#imstatuserror").hide();
$("#aimstatus").hide();
$("#icqstatus").hide();
$("#imrefreshbutton").hide();
$("#imstatus_updating_message").show();
$.ajax({
url: "imstatus.php",
data: {"aim": "{/literal}{$aim|default:'(none)'}{literal}", "icq": "{/literal}{$icq|default:'(none)'}{literal}"},
dataType: 'json',
async: false,
error: function(XMLHttpRequest, textStatus, errorThrown) {
$("#imrefreshbutton").show();
$("#imstatuserror").show();
},
success: function (data, textStatus) {
data = unserialize(data);
icq = data['icq'];
aim = data['aim'];
if (icq != "none") {
$("#icqstatus").hide();
imgtarget = document.images["icqstatus_img"];
if (icq == "online") {
imgtarget.src = "images/icq.gif";
imgtarget.alt = "{/literal}{$icq}{literal} (Online)";
imgtarget.title = "{/literal}{$icq}{literal} (Online)";
}
else {
imgtarget.src = "images/icq-offline.gif";
imgtarget.alt = "{/literal}{$icq}{literal} (Offline)";
imgtarget.title = "{/literal}{$icq}{literal} (Offline)";
}
}
if (aim != "none") {
$("#aimstatus").hide();
imgtarget = document.images["aimstatus_img"];
if (aim == "online") {
imgtarget.src = "images/aim.gif";
imgtarget.alt = "{/literal}{$aim}{literal} (Online)";
imgtarget.title = "{/literal}{$aim}{literal} (Online)";
}
else {
imgtarget.src = "images/aim-offline.gif";
imgtarget.alt = "{/literal}{$aim}{literal} (Offline)";
imgtarget.title = "{/literal}{$aim}{literal} (Offline)";
}
}
$("#imstatus_updating_message").hide();
$("#imrefreshbutton").show();
}
});
}
What am I doing wrong?