like button isn't working

Javascript coding ..

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 3
Joined: Thu Jan 24, 2013 4:50 am

like button isn't working

Postby suchait24 » Sat Feb 09, 2013 8:57 am

Hi frds

I created a like button

What i need : when user click on this button,it must be disabled

my problem: code isn't working....

<script type="text/javascript">

$(function() {

var ID = $(this).attr("id");
var dataString = 'msg_id='+ ID; //passing id of msg

type: "POST",
url: "count_like.php", //php script which contains the backend working .
data: dataString,
cache: false,
success: afterSuccess //call function after success


return false;


function afterSuccess() { //this part of function isn't working





In this code ajax calling is working fully fine as i need but disabling function isn't working...

help please
Thnx in advance

php-forum Fan User
php-forum Fan User
Posts: 920
Joined: Mon Oct 01, 2012 12:32 pm

Re: like button isn't working

Postby seandisanti » Wed Mar 06, 2013 3:22 pm

in the working section, your selector is grabbing elements with the 'like' class, in the other section your selector is for the 'like' id. Without seeing your html for the button, I would assume that the one not working is using the wrong selector.

Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 1 guest