html
<span id="count" style="margin-top: -5%;" class="likes_count">5 likes</span>
this is my javascript code
$(document).ready(function(){
// when the user clicks on like
$(document).on('click','.like',function(){
$('.like').addClass('animated bounceIn');
var postid = $(this).data('id');
var id = $(this).attr('data-likes');
$post = $(this);
$.ajax({
url: 'dashboard.php',
type: 'POST',
data: {
'liked': 1,
'postid': postid
},
success: function(response){
$post.parent().find('span.likes_count').text(id+1+"likes");
$post.addClass('hide');
$post.siblings().removeClass('hide');
}
});
});
i am fetching nuber of like in id variable but dont know how to increase it on success ive tried it in my code but not working it is adding 1 in front of the whole number any helps
...text(parseInt(id)+1+"likes")