问题
I am using ExtJS 3.4. I have a long running asynchronous process that I need to wait until it is finished. It works fine for Firefox but Internet Explorer will not wait. How do I solve this problem?
Here is what I have for the client side code:
function SaveUser(form, myDataObject, url) {
if (form.isValid()) {
StatusMessage.show('Please wait. New User Registrations may take up to one minute to complete.');
Ext.Ajax.request(
{
url: url,
method: 'POST',
timeout: 30000,
params: myDataObject,
success: function (result, request) {
StatusMessage.hide();
formSubmit = Ext.util.JSON.decode(result.responseText);
if (!formSubmit.success) {
Ext.Msg.show({
title: 'Error',
msg: formSubmit.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.WARNING,
minWidth: 390,
maxWidth: 390,
closable: false
});
} else {
ShowRegistered();
}
},
failure: function (result, request) {
StatusMessage.hide();
ShowServerError(result);
}
});
} else {
ShowValidationErrors();
}
}
Here is what I have for the server side code:
CreateUserInActiveDirectory(user);
//Internet Explorer Time Out immediately instead of waiting here
System.Threading.Thread.Sleep(20000);
AuthenticateUser(user);
回答1:
This is not an extjs problem but an IE problem instead. In fact, 30000 is the default timeout for extjs.
Most of the times this is because the global IE global timeout setting. Take a look at HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings for the ReceiveTimeout key, if it is there then remove it, if not create it with a value in milliseconds.
If this problem is new and has never happend before, check the latest software products that you installed recently, there are several ones which set this value.
来源:https://stackoverflow.com/questions/13804266/extjs-ajax-request-timeout-has-no-affect-with-internet-explorer