Search
 
SCRIPT & CODE EXAMPLE
 

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);				
			}
		});
	});
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: a to z in js using while 
Javascript :: parse curency 
Javascript :: iterating over an array 
Javascript :: Truncate a Stringtarget 
Javascript :: add validation in strapi 
Javascript :: nested loop javascript 
Javascript :: how to show conditional show on select field 
Javascript :: scriptable alert 
Javascript :: how to return a value to the parent function from ajax javascript 
Javascript :: adding number in an array using the .forEach() method in javascript 
Javascript :: Lodash Cypress for each function 
Javascript :: angular pass template value from component 
Javascript :: filewatcher nodejs 
Javascript :: javasript vetical menu cog 
Javascript :: why promise goes to microtask and settimeout to browser api 
Javascript :: js array take a elemt to front 
Javascript :: rxjs: from usage 
Javascript :: window.print specific div 
Javascript :: id on delete action javascript react 
Javascript :: react native asyncstorage mergeItem 
Javascript :: discord.js v12 to v13 
Javascript :: array of function 
Javascript :: drag and drop pic using hooks pure js 
Javascript :: Finding Attribute value with playwright in node.js 
Javascript :: nodejs post req accept form data 
Javascript :: react stream chat 
Javascript :: add and remove multiple markers on google maps js 
Javascript :: mindate from another datepicker 
Javascript :: JS get dropdown setting 
Javascript :: A Note about Floats 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =