jquery – 如何访问$(this)里面的ajax成功回调函数

似乎我不能访问$(this)里面的jquery ajax成功函数。请看下面的代码
$.ajax({
            type: 'post',url: '<?PHP echo site_url('user/accept_deny_friendship_request')?>',data: 'action='+$action+'&user_id='+$user_id,success: function(response){
               //cannot access $(this) here $(this).parent().remove();
            }
        });

解决方法

$(这)应该是什么?如果你在该函数之外引用了它,你可以将它存储到一个变量中。
$('#someLink').click(function() {
    var $t = $(this);
    $.ajax( ...,function() {
        $t.parent().remove();
    });
}

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: &lt;span id=&quot...
jQuery 添加水印 &lt;script src=&quot;../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...