AJAX polling script is used for getting user perception (vote result) about any research, Ajax is used to return the results from this poll to your browser.
The following example will demonstrate a poll where the result is shown without reloading.
When a user chooses an option above, a function called "getVote()" is executed. The function is triggered by the "onclick" event:
Output :
The value is sent from the JavaScript, and the following happens:
The text file (poll_result.txt) is where we store the data from the poll.
It is stored like this:
0||0
The first number represents the "Yes" votes, the second number represents the "No" votes.
Note: Remember to allow your web server to edit the text file. Do NOT give everyone access, just the web server (PHP).