$ (This) becomes invalid after jQuery uses ajax. The reason is simple. $ (this) points to the jquery object that recently called it, that is, $ (this) indicates the ajax object, the solution is also very simple, when using $. before ajax ({})
$ (This) becomes invalid after jQuery uses ajax. The reason is simple. $ (this) points to the jquery object that recently called it, that is, $ (this) indicates the ajax object, the solution is also very simple, when using $. $ (this) is assigned to a variable before ajax ({}), and then $. used in ajax ({}), as follows:
$ ('. Operating. L '). live ('click', function () {var obj = $ (this); $. ajax ({url: '/information/picture/delimag', type: 'post', dataType: 'json', data: 'image _ url =' + $ (this ). parents (). siblings ('img '). attr ('src') + '& article_id =' + ARTICLE_ID, success: function (data) {if (data. error_code) {infotips (data. msg, $ (". submit_tips "), 'error'); return false;} else {obj. parents ('. list '). remove (); infotips ('deleted successfully', $ (". submit_tips "), 'right ');}}});});