I call the getResult() function everytime when res.reply = 2, but there are cases that res is empty. When the returned value is empty console.log("error") is invoked. This works in older versions of jQuery Mobile. Now the version is 1.3.2.
function getResult()
{
request = $.ajax({
type: "POST",
url: url,
dataType: "json",
data: {
....
},
error: function() {
console.log("error");
},
success: function(res) {
if(res.reply=='2') {
getResult();
}
}
});
}
errorhandler does not necessarily mean the response is empty - it most commonly means that a response could not be retrieved due to an error on the server. Check the network traffic in Firebug and your server logs for an error.error : function (xhr,err){ console.log(xhr);console.log(err); }