AJAX + PHP voting system

atmopybeato

New Member
I'm working on a voting system in AJAX and PHP and I've run into a bit of trouble. We're displaying a bunch of posts from our database and each post has an image next to it -- clicking the image is supposed to 1) toggle the image colour and then 2) use AJAX call a PHP script which then decides whether to add or subtract a vote. I have the image toggle working, but I'm not sure how to do the next part. What's the best way to do this? This is the while-loop which outputs the posts:\[code\]while($row = mysql_fetch_array($result)) { ?> <li class = "post"> <a href = "http://stackoverflow.com/questions/3604953/#" onclick = "return toggle(this,'heart<?php echo $row['post_id'];?>')"><img name = "heart<?php echo $row['post_id'];?>" src = "http://stackoverflow.com/images/heart.png" class = "thumbnail" width = "15" /></a> <p class = "title"><img class = "favicon" width = "16" height = "16" src = "http://stackoverflow.com/questions/3604953/<? echo $row['favicon']; ?>" /><a href = "http://stackoverflow.com/questions/3604953/<? echo $row['post_url']; ?>" target = "_blank"><? echo $row['post_title']; ?></a></p> <p class = "postinfo">posted <? echo doRelativeDate( $row['date'] ); ?> by <a href = "http://stackoverflow.com/questions/3604953/<? echo $row['blog_url'];?>"><? echo $row['blog_name']; ?></a> </li> <? } ?>\[/code\]
 
Back
Top