Extjs-Ext.Ajax.request设置超时

ExtJs的Ajax提交主要是:Ext.Ajax.request或form1.getForm().submit,超时时间默认是30秒。

很多时候,后台处理比较多,往往需要超出30秒的限制。此时,可以通过修改超时时间来打破限制。

方法一:

更改默认值的方式:

Ext.Ajax.timeout=100000;  //100秒
Ext.Ajax.request({
url:'...........',
params : '',
method : 'POST',
success : function(response,options){
  ...............
},
failure : function(response,options){
 ............
}
});

此方式会改变request的默认超时时间, 对往后所有request都有影响。

方法二:

可以直接增加选项,此方式只对当前request都有影响。

如:

Ext.Ajax.request({
timeout: 600000,
url:'...........',
params : '',
method : 'POST',
success : function(response,options){
  ...............
},
failure : function(response,options){
 ............
}
});
原文地址:https://www.cnblogs.com/hwaggLee/p/4874379.html