Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

like and dislike function

$(document).ready(function() {
	$(".options").on("click", function(){
		var id = $(this).attr("id");
		id = id.replace(/D/g,'');
		var vote_type = $(this).data("vote-type"); 
		$.ajax({				
			type : 'POST',
			url  : 'vote.php',
			dataType:'json',
			data : {id:id, vote_type:vote_type},
			success : function(response){
				$("#vote_up_count_"+response.id).html("  "+response.vote_up);
				$("#vote_down_count_"+response.id).html("  "+response.vote_down);				
			}
		});
	});
});
Source by coderszine.com #
 
PREVIOUS NEXT
Tagged: #dislike #function
ADD COMMENT
Topic
Name
2+5 =