When I recently submitted a form that contains files using jquery.form.js, I ran into a problem: when we hit a slow speed and we set up timeout, for Example:
var options = { timeout:3000 // limit request time, when request is greater than 3 seconds, jump out of request }
Our page will die here and post the results returned by the F12 developer Tool:
At this point, we do not handle the error callback function, and Baidu came out of the example of only these two callback functions:
Beforesubmit:showrequest,//pre-commit callback function
Success:showresponse,//post-commit callback function
so, I went to the official website to view the api, official Website: http://malsup.com/jquery/form/#options-object, and sure enough, I found the callback function to handle the error:
Error function to is invoked upon Error.
So my options are written like this:
var options = { beforesubmit:showrequest, // pre-commit callback function success : showresponse, // Post successful callback function error:showerror, //post-commit Error callback function
timeout:3000 // limit the request time, when the request is greater than 3 seconds, jump out of the request
}
The callback function is written like this:
function showerror (responsetext, Statustext) { if(statustext== ' timeout ') { Layer.msg ("the server is busy, please try again Later!") ", {icon:5,time:1500}); return ; }}
This is my solution, do not know the solution to your problem did not?
Jquery.form.js Resolution for connection Timeout (timeout) cannot be resolved