timeout works! but when timeout I want to run a function. do you have any ideas?
$.ajax({
type: "GET",
url: "xajax.php",
timeout: 100,
data: "name=John&location=Boston",
success: function(msg){ alert( "Data Saved: " + msg ); }
timeout works! but when timeout I want to run a function. do you have any ideas?
$.ajax({
type: "GET",
url: "xajax.php",
timeout: 100,
data: "name=John&location=Boston",
success: function(msg){ alert( "Data Saved: " + msg ); }
Probably your json object response is incorrect, check it for example in: - http://jsonlint.com/
you could check it too in your browser console/network specs to see if it is in client or server side.
You could display what you are sending from server ( after create json object) in order to see if you are sending correctly.
$.ajax({
type: "GET",
url: "xajax.php",
timeout: 100,
data: "name=John&location=Boston",
success: function(msg)
{
$("#result").html("here is result: "+msg);
}
complete: function(jqXHR, textStatus)
{
if (textStatus == "timeout")
{
$("#result").html("TIMEOUT!");
}
}
});