Hi everyone,

I'm using jquery in this piece of script and also trying to call the functions. But, they aren't working at ALL and the firefug is saying that there is an error in the script. The error is

missing ) in parenthetical
[Break On This Error]

$.post('ajax/like_add.php', (article_id:article_id), function(data){

and the firebug points to the colon.


This is the entire piece of script that has both functions.

function like_add(article_id){
	$.post('ajax/like_add.php', (article_id:article_id), function(data){
		if(data == 'success'){
			like_get(article_id);
		}else{
			alert(data);
		}
	});
}


function like_get(article_id){
	$.post('ajax/like_get.php',(article_id:article_id), function(data){
		$('#article_'+article_id+'_likes').text(data);
	});
}

Thanks, folks.

The second parameter of post(), the data, should use curly brackets, and not parenthesis.

where can i find like_add.php or is this it and it links to itself?

like_add.php is inside the folder ajax in your server. it will handle your ajax request, it is the backend of your ajax call.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.