: How to using ajax for voting script I'm trying to set up some voting logic on my site, and have the vote result update without refreshing the site. I did some research and AJAX seems to
I'm trying to set up some voting logic on my site, and have the vote result update without refreshing the site. I did some research and AJAX seems to be the way to go, but I can't find a good tutorial on it.
I'm doing the update to Mysql
$query = "update RR_upload set vote = vote".$vote." where id = '".$var1."'";
mysql_query($query, $connection) or die (mysql_error());
How do I make it so AJAX updates the content of the site after running the vote update?
More posts by @Kevin317
1 Comments
Sorted by latest first Latest Oldest Best
This question may be a better fit for StackOverflow.
This tutorial should help you get going: articles.sitepoint.com/article/ajax-jquery
Basically, AJAX will invoke a server side script that updates the DB and returns the new state of the poll.
When the AJAX query is made a function is assigned for the call back (AJAX is asynchronous so you have to assign a Javascript function that will be run when the response comes back) that happens once the server side script returns. The callback function then updates the HTML page with the new info.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.