jQuery("#up a").click(function () {
$.ajax({
type: "POST",
url: "vote.php?up=<? echo $row['post_id']; ?>",
});
});
$row['vote_count'] // Displays the number of votes
When a user clicks the button it processes the vote.php page and adds a vote to the database. How can I use jQuery to simply increment the $row[‘vote_count’] result by +1 without refreshing the page.
On a side note i found the following two things that you should watch out for next time when coding in JavaScript:
You mixed your jQuery declarations between $ and jQuery, you should use either one or the other but never both at the same time as it’s bad practice in my opinion
You had an extra comma in your object you passed into your $.ajax() method, this will cause an error in IE so just something to watch out for