最近在用EXtjs做项目,在加载数据量特别大的时候会出现加载超时现象,在FB下查看,原来是ext默认ajax请求30秒。
在网上搜到下面的解决方法,以备参考和其他人参考。

ExtJS做Aj">
Home > Web Front-end > JS Tutorial > Solution to Ajax request timeout when the amount of data is large_extjs

Solution to Ajax request timeout when the amount of data is large_extjs

WBOY
Release: 2016-05-16 16:57:49
Original
1660 people have browsed it
Solution to Ajax request timeout when the amount of data is large_extjs
I am currently working on a project using EXtjs. When the amount of data loaded is particularly large, a loading timeout will occur. Checking it under FB, it turns out that ext’s default ajax request is 30 seconds.
Search the following solutions on the Internet for reference and reference by others.

When ExtJS makes an Ajax request, the default response time is 30 seconds. If the subsequent data query time exceeds 30 seconds, ExtJS will report an error.
This requires modifying the timeout of ExtJS:
2 methods:

1: Add: (timeout: 100000000) attribute
Copy code The code is as follows:
Ext.Ajax.request({
url: 'foo.php',
success : someFn,
failure: otherFn,
timeout: 100000000,//default 30000 milliseconds
headers: {
'my-header': 'foo'
},
params: { foo: 'bar'}
});

Ext.Ajax.request({ url: 'foo.php', success: someFn, failure: otherFn, timeout: 100000000,/ /default 30000 milliseconds headers: { 'my-header': 'foo' }, params: { foo: 'bar' } });

2: Add: Ext.Ajax.timeout at the beginning of js = 180000;

Copy code The code is as follows:
Ext.onReady(function() {
Ext.BLANK_IMAGE_URL = '../../common/ext3/resources/images/default/s.gif ';
Ext.Ajax.timeout = 180000;
vardateType;//Report type
Ext.onReady(function() { Ext.BLANK_IMAGE_URL = '../../common/ext3/resources/images/default/s.gif '; Ext.Ajax.timeout = 180000; var dateType;//Report type After testing, it was found that the first setting was invalid, but the second setting was effective.

I was too busy, so I tested it here first. I felt that the best thing to do was to optimize the database. After all, make a query. , asking users to wait for 3 minutes is definitely unacceptable for even 1 minute.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template