Click here to Skip to main content
15,889,889 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<head>
<script type="text/javascript" src="scripts/jquery.js"></script>
 <script type="text/javascript">
$(document).ready(function(){
    $('a.like').click(function () {
        $.post("like.cfm", {postid:$(this).attr("postid"),uid:$(this).attr("uid")} );
        $(this).hide();
        $(".unlike").show();
        $(".hw").html($(".hw") + 1);

    });
    $('a.unlike').click(function () {
        $.post("unlike.cfm", {pageID:$(this).attr("postid")} );
        $(this).hide();
        $(".like").show();
        $(".hw").html('-1');
        $(".hw").html($(".hw") - 1);
    });
});
</script>
</head>
<body>
<a href="##" class="like" postid="1234" uid="131">Like</a>
<a href="##" class="unlike" style="display:none;" postid="1234">Unlike</a>
<span class="hw">100</span>
</body>



Clicking on like link i want to add +1 in "hw" value ! But the code i'm using is not working :(
Posted
Updated 30-May-14 1:10am
v2

1 solution

do this

PHP
$('a.like').click(function () {
       $.post("like.cfm", {postid:$(this).attr("postid"),uid:$(this).attr("uid")} );
       $(this).hide();
       $(".unlike").show();
       var test=$('span.hw').html();
       test++;
       $(".hw").html(test);

   });
 
Share this answer
 
Comments
liquidsmoke07 30-May-14 7:27am    
Thnaks Naz ! You made my day :)
Naz_Firdouse 30-May-14 7:43am    
you are welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900