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

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

apache - Add omitted ? to URLs -

php - How can I stop spam on my custom forum/blog? -