jQuery: Hide Ajax Loaded Div After Additional Ajax Request -


jquery('.delete-tag').live('click', function(e) {     e.preventdefault();      var id = jquery(this).attr('id');      var data_string = "ajax=1&tag-id=" + id + "";      jquery.ajax({         type: "post",         url: file_path + "tags/edit/delete/",         data: data_string,         datatype: "json",         success: function(ajax_output) {             jquery(this).hide();         }     }); }); 

the .delete-tag link loaded via ajax in modal window. use live() bind click event link. ajax runs ok, can't hide() work on ajax loaded link.

suggestions? works except hiding.

once inside ajax success function, this points different object. store origional reference in variable:

var orig = jquery(this); jquery.ajax({         type: "post",         url: file_path + "tags/edit/delete/",         data: data_string,         datatype: "json",         success: function(ajax_output) {             orig.hide();         }     }); 

Comments

Popular posts from this blog

jQuery clickable div with working mailto link inside -

java - Getting corefrences with Standard corenlp package -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -