I’m utilizing the magic of jQuery.ajax( settings )
.
However, I’m wondering if anyone has played with the timeout setting much?
I know it’s basically for dictating the local time for a request, but can it trigger anything if the timeout is reached? Or does it simply stop listening for a response?
Reading the jQuery site, I can see there are no arguments passed, so it seems like a simple setting with one capability. Which is fine.
But, I’d like to trigger an alert or some function if the timeout is reached. I can see that the error setting doesn’t get triggered, in this case.
Here’s my snippet:
$("form#testform").submit(function(){
var allFormValues = $("form#testform").serialize();
$.ajax({
cache:false,
timeout:8000, // I chose 8 secs for kicks
type:"POST",
url:"someurl.php",
data:allFormValues,
error:function(){ alert("some error occurred") },
success:function(response){ alert(response); }
});
});
Does anyone know how to work more with timeout?