【发布时间】:2014-09-15 11:43:20
【问题描述】:
我有这个 Javascript 代码:
this.confirmBox = function(event, data) {
return bootbox.confirm("Are you sure?", function(result) {
alert(result); // this returns TRUE as it is supposed to
});
};
this.beforeSend = function(event, jqXHR) {
if (this.confirmBox()) {
// HERE THE AJAX QUERY GETS EXECUTED
} else {
return jqXHR.abort(); // HERE WE ABORT IT
}
};
我的问题是 ajax 查询在我在 bootbox 弹出窗口中确认之前被执行。我如何需要更改(this.confirmBox()) 行,以便让 beforeSend 函数检查 confirmBox 函数是否返回 true?
【问题讨论】:
标签: javascript ajax bootbox