i have this jquery code with an ajax request that works fine, but the jquery is not displaying the results(vote_count) and changing the upvote image, just like stackoverflow:
jquery code:
$(function(){
$("a.vote_up").click(function(){
//get the id
the_id = $(this).attr('id');
//the main ajax request
$.ajax({
type: "POST",
data: "action=vote_up&id="+$(this).attr("id"),
url: "ajax/votes.php",
success: function(msg)
{
//echo the votes count
$("span#votes_count"+the_id).html(msg);
//replace the new vote count
$("span#votes_count"+the_id).fadeIn();
//replace the image with active arrow
$("#vote_up"+the_id).attr("src", "img/upvoteActive.png");
}
});
});
the html code:
<li class ="record">
<span class="vote_count">$net_vote</span>
<a href='#' class='vote_up' id=$id><img src="img/uparrow.png"></a>
<a href='#' class='vote_down' id=$id><img src="img/downarrow.png"></a>
</li>
to clarify everything again, the ajax request is fine its upvoting the right answer, the problem is in the success bit of the ajax, the new vote count is not showing, and the image is not being replaced to an active arrow(just like stack overflower) thanks :))