How can I solve the timeout of Ajax requests when the data volume is large?

Source: Internet
Author: User

 
Recently, EXtjs was used as a project. When loading a large amount of data, loading times out. In FB, it turns out that ext's default ajax request is 30 seconds.
Find the following solution on the Internet for your reference and other people's reference.

When ExtJS makes an Ajax request, the default time is 30 seconds. If the data query time exceeds 30 seconds, ExtJS reports an error.
In this case, you need to modify the ExtJS timeout time:
Two methods:

1: add the :( timeout: 100000000) attribute during Ajax requests.
Copy codeThe 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-head': 'foo'}, params: {foo: 'bar '}});

2: Add Ext. Ajax. timeout = 180000 at the beginning of js;
Copy codeThe 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; // after the report type test, the first setting is invalid, and the second setting is valid.

If the relationship is too busy, we can test it first. I think the most important thing to do is to optimize the database. After all, it is unacceptable to make a query so that users can wait for three minutes. 1 minute is unacceptable.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.