Tell me more ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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 cant find a good tutorial on it.

im 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 udates the content of the site after running the vote update?

share|improve this question
1  
definitely a programming question – Jeff Atwood Aug 16 '10 at 10:29

closed as off topic by Jeff Atwood Aug 16 '10 at 10:29

Questions on Webmasters Stack Exchange are expected to relate to webmastering within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

up vote 1 down vote accepted

This question may be a better fit for StackOverflow.

This tutorial should help you get going: http://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.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.