简体   繁体   中英

How to speed up AJAX?

I have a custom AJAX survey script. I want to improve the efficiency of how it handles information to really speed it up for my users. The CSS needed to style subsequent AJAX view is located in the website's main CSS as it shares many similar selectors, and is cached on load using..

<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
Header set Last-Modified "Tue, 31 Aug 2010 00:00:00 GMT"
Header set Expires "Thu, 15 Apr 2014 20:00:00 GMT"
Header set Cache-Control "public, no-transform"
</FilesMatch>

Will AJAX use this cached information to reduce round trip request time?

Html markup for each subsequent AJAX view is different so I understand that info would have to be fetched, parsed, and returned. If setting caching headers can't do the job, seems some client side scripting could be directed to check cache for information first, if it needs more information then go get it from server (such as html markup.)

Any help would be appreciated. Hope you can set me on the right path here.

Those directives won't affect a PHP script being requested via AJAX. One thing you should do is cache the output of the script being requested. I really like this method:

http://www.addedbytes.com/for-beginners/output-caching-for-beginners/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM