Ajax real-Time refresh issues
Recently done a project, there is an application, the user, I can see his name and on-line. But I have to constantly refresh the page when I read this. I use JS to refresh every few seconds, but placed on the server because of the large amount of data, refresh one time is slower. I hear Ajax can be solved. I studied for a while and looked at some examples, and it was all about triggering. So confused, I hope there are experienced Chengyuan can give a small example or something. Thank you first.
------Solution--------------------
Using long polling can solve this problem
You're on the web looking for a comet tutorial
But if your data is really big, it's going to have to be solved by optimization first.
------Solution--------------------
Ajax is best used for local small data volume refresh, big data must be optimized, lazyload
------Solution--------------------
Comet, Server push
www.ibm.com/developerworks/cn/web/wa-lo-w2fpak-comet/
------Solution--------------------
The purpose of Ajax is to use local refresh, to reduce the load of large data volume,
This involves your own project to cut out an interface to the AJAX transceiver data support, not simply to modify the JS problem.
Look, you've never been in touch with Ajax, take it slow.
Suggest you to open a page, such as ajax.php, first familiar with/test the function of Ajax
Then write this function as a function, and then include it in the call.
------Solution--------------------
If the volume of data is large, with Ajax local refresh and the overall page refresh speed is not much different
If the small amount of data, with Ajax partial refresh, the time to load other resources on the page!
When a large amount of data is removed from the library, the loading time of other resources on the page is negligible!
Choose according to your situation! The amount of data is large or optimized!
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