jquery pass parameter to ajax callback

zyip發表於2014-07-30

 

 

 

            $('.del').on('click', function () {
                var id = $(this).attr('id');
                var url = '/m/g2_content_del/' + id;
                var that = this;



                $.post(url, function (a, b, c, d) {

                    var getItem = function () {
                        return function () {
                            return that;
                        };
                    }

                    var current = getItem()();
                    var data = a;
                    if (data.status == 200) {
                        $(current).parent().parent().remove();
                    }
                });
            });

 

相關文章