Home >Backend Development >PHP Tutorial >Ask a very simple static page AJAX voting question_PHP tutorial
Ask a very simple static page AJAX voting question
Let me answer
Website ideas and solutions
When I first met AJAX, I had a lot of confusion.
The page automatically generates a static page every 20 minutes. Assume that the number of votes at time a is 100. After 20 minutes, 3 people vote at time b. When the static page is generated again, the number of votes becomes 103.
I want to know, suppose m1, m2, m3, three people open the browser accordingly and vote. After m1 opens the static page, the display is 100. After the vote, it is displayed as 101. After that, m2 opens the browser. At this time, m2 static page Is the number of votes displayed on the page 100 or 101? In other words, when the server is not re-static, the static page seen by M2 is the number of votes at time a or the number of votes after m1 has finished voting.
If m2 sees 101 votes, how is the value passed during that period? Thanks!
Website ideas and solutions
Using AJAX, you can also return the total number of votes in the database when voting
Website ideas and solutions
Of course you can
Website ideas and solutions
Static has been generated, so how does the constant number of votes become a variable and change?
Website ideas and solutions
Use js to send an asynchronous request to the background script, return the relevant data after processing, and dynamically update the div to be displayed in the callback function~
Website ideas and solutions
Using ajax, you can access your dynamic page with just one event and then transfer the data there. Data can also be accepted
Website ideas and solutions
I asked the same poster, I also want to know ~~~~
Website ideas and solutions
OK, got it. Thank you all!