jquery pass parameter to ajax callback

 

 

 

            $('.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();
                    }
                });
            });

 

posted @ 2014-07-30 09:49  zyip  阅读(204)  评论(0编辑  收藏  举报