ajax 确认 取消对话框,无法在ajax成功中关闭对话框

我即时调用一个对话框(点击),而不是先将其设置为var。像这样:

$(".deleteSaved").click(function() {

save_id = $(this).attr('id');

div="

Are you sure you want to delete this?
";

$(div).dialog({

buttons: {

"Delete": function() {

$.ajax ({

url:"util.php",

data:"q=0&f=delete&save_id="+save_id,

success: function(result){

$(this).dialog("close"); //this line is not working

$("#toprow"+save_id).fadeOut();

$("#botrow"+save_id).fadeOut();

}

})

},

"Cancel": function() {

$(this).dialog("close");

}

},

modal: true,

title: 'Delete Saved Signal',

resizable: false

});

});

但是当我在ajax成功函数中调用$(this).dialog("close");时,我收到以下错误:

Uncaught cannot call methods on dialog prior to initialization; attempted to call method 'close'

在" cancel"按钮$(this).dialog("close");工作得很好。

如何在ajax成功通话中使用close函数?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值