A simple solution to how to control the AJAX read data of a page read only once!

Source: Internet
Author: User

For example: A page has a button, click the time with Ajax to get the data in the background, to obtain a successful return. Don't get the data the next time you click.

There are many ways to solve this problem:

1. Use the Get method to read the data and cache it.

2. Use the jquery data method to manually cache and read the data to determine if the cache exists.

My solution is to give the button a flag when the button loads it does not go backstage to get the properties of the data (such as Readnot).

Then use Removeattr ("Readnot") to remove this property after the first time you have gone to the background to get the data successfully.

This will only determine if the Readnot attribute is present each time the button is clicked.

A simple solution to how to control the AJAX read data of a page read only once!

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.