Ajax requests a workaround for timeouts when data volume is large _EXTJS

Source: Internet
Author: User

Recently in the use of ExtJS to do projects, in the loading of data is particularly large when loading timeout phenomenon, under the FB view, the original is ext default Ajax request 30 seconds.
Search the following solution online for reference and others.

ExtJS do Ajax request, the default corresponding time is 30 seconds, if the later data query time more than 30 seconds, ExtJS will be an error.
This requires modifying the ExtJS timeout:
2 ways:

1: At the time of Ajax request add: (timeout:100000000) attribute
Copy Code code 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 hea DERs: {' my-header ': ' foo '}, params: {foo: ' Bar '}};

2: In the beginning of JS after add: Ext.Ajax.timeout = 180000;
Copy Code code 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 test found that the first setting is invalid and the second setting is valid.

Too busy relationship, the first test to here, think the most should do or to optimize the database, after all, make a query, let users wait a 3 minutes, it is certainly unacceptable. It's not acceptable for 1 minutes.
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.