jquery-How can a group of data interact with a database in real time with ajax+php?

Source: Internet
Author: User
I have traversed a set of data from the database, rendered into the table, now requires the background to change the data in the database, the foreground can immediately change the data. Best to give a reference code, thank you.

Reply content:

I have traversed a set of data from the database, rendered into the table, now requires the background to change the data in the database, the foreground can immediately change the data. Best to give a reference code, thank you.

HTTP is stateless.
Therefore, in theory, it is unrealistic for the server to proactively push information to the client.

Of course, the method is some, is the client JS polling, there are long connections, websocket, the actual application of seemingly polling methods used more.
The simplest implementation, the front-end JS code design a timer, and then each time interval to query database data updates, of course, so that the pressure on the server is conceivable, the need for data storage and query methods to do a lot of optimized design, appropriate cache.

I have a project the user is not many, the data in 20 field around, 1W records within, the pressure itself is not very small, using the data from the database to get the snapshot serialized into the SAE KV database, the server changes, while updating the KV database content, the client query is updated, The direct use of KV data to express, to a certain extent, to solve the pressure problem.

I wish I could give you some inspiration.

  • 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.