Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 0.71 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Dynamic elements reappear after being deleted jQuery
  2. $(document).on("submit", ".comment_form", function(event){
  3.     event.preventDefault();
  4.  
  5.     var self=$(this);
  6.  
  7.     var h=self.serialize();
  8.     var data;
  9.     $.post(self.attr("action"), h, function(returnData){
  10.         data = returnData;
  11.     })
  12.     $(this).ajaxSuccess(function(){
  13.         //alert($(data).find(".vsi-komentarji").html());
  14.         self.parent().next().html($(data).find(".vsi-komentarji").html());
  15.     });
  16.  
  17.     $(':text', '#comment_form').val('');
  18.     //return false;
  19. });
  20.  
  21. jQuery.fn.deleteComment = function(turl) {
  22.     $.post(turl, function(){});
  23.     $(this).parents(".comm").slideUp('slow', function(){
  24.         $(this).remove();
  25.     });
  26.     return false;
  27. }