Home > Web Front-end > JS Tutorial > The difference between prototype and Ajax implementation under jquery_javascript skills

The difference between prototype and Ajax implementation under jquery_javascript skills

WBOY
Release: 2016-05-16 18:46:43
Original
945 people have browsed it

Let’s first list the implementation of Ajax in Jquery and prototype.
Jquery:

Copy code The code is as follows:



prototype:
Copy Code The code is as follows:



Actually, the prototype cannot be refreshed after the setInterval function is introduced. Why is this?
It turns out that the prototype has a caching mechanism for the same URL, so the page cannot be refreshed. Especially after the user uses F5 or clicks "Refresh", there will be a bug that the Ajax response area is blank, so the prototype must not be refreshed.
Add a random number to the URL in the prototype
Original: var remoteUrl = 'index.php';
After modification: var remoteUrl = 'index.php?rand=' Math.random();
Use the GET method to generate a parameter that has nothing to do with page display.
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