Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as JavaScript by asasasas ( 15 years ago )
$(function() {
 $('.like').live('click',function()
 {
  var element = $(this);
  var id = element.attr("id");
  alert('Step 1');
  $.ajax({
   type:"POST",
   data:"postid"+id,
   url: "/ajax/likepost",
   success: function(data){
    alert('Send Request');
    $(this).html('<img src="loading.gif" alt="please wait..."/>');
    if(data=='OK')
    {
        alert&#40;data&#41;;
     $(this).empty();
        $(this).removeClass('like');
        $(this).addClass('unlike');
        return true;
    }
   }
  });
 });
 $('.dislike').live('click',function()
 {
  var element = $(this);
  var id = element.attr("id");
  
  $.ajax({
   type:"POST",
   data:"postid"+id,
   url: "/ajax/dislikepost",
   success: function(){
    $(this).html('<img src="loading.gif" alt="please wait..."/>');
    if(data=='OK')
    {
     $(this).empty();
        $(this).removeClass('unlike');
        $(this).addClass('like');
        return true;
     }
   }
  });
 });
});

 

Revise this Paste

Your Name: Code Language: