JQuery.form.js is a form plugin that supports AJAX form submission and Ajax file uploads.
When you recently submitted a form that contains files using Jquery.form.js, you have a problem: when you run into a slow speed, and we set up timeout, for example:
var options = {
timeout:3000//Limit requested time, jump out of request when request is greater than 3 seconds
Our page will die here and post the results returned by the F12 developer tool:
At this point, we do not have a callback function to handle the error, and the example of Baidu is the only two callback functions:
Beforesubmit:showrequest,//Pre-submit callback function
Success:showresponse,//Submit callback function
So, I go to the official Website View API, official website: http://malsup.com/jquery/form/#options-object, sure enough to find the callback function that handles the error:
The error
Callback function to is invoked upon error.
So that's what my options say:
var options = {
beforesubmit:showrequest,//Pre-submit callback function
Success:showresponse,//Post successful callback function
error: ShowError,///Post error callback function
timeout:3000//Limit request time, jump request when request is greater than 3 seconds
This is what the callback function says:
function ShowError (responsetext, statustext) {
if (statustext== ' timeout ') {
layer.msg ("Server busy, please try again later!") ", {icon:5,time:1500});
return;
}
The above is a small set to introduce JQuery.form.js plug-ins can not solve the connection timeout (timeout reason analysis and solutions, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!