我已经设置了一个确认对话框,用两个按钮打开,一个按钮执行ajax请求,另一个按钮关闭一个对话框。
如果来自ajax请求的响应为false,我想替换这两个按钮。
如果有人能指出我正确的方向,那将是值得赞赏的。
这是我到目前为止所做的。
$('body').on('click','.stream_mg_rmv',function(e){
e.preventDefault();
var id = $(this).data('id');
data = "<div><h4>This stream will be removed. This action cannot be undone. Are you sure?</h4></div>";
$(data).dialog({
buttons : {
"Yes": function(){
if(delete_stream(id)){
$(this).dialog('close');
$('.stream_mg_modal').dialog('close');
get_streams();
} else {
$(this).prepend("AN ERROR OCCURED");
}
},
"Cancel":function(){
$(this).dialog('close');
}
}
});
});