我有这个 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 查询。(this.confirmBox())
为了让 beforeSend 函数检查 confirmBox 函数是否返回 true,我需要如何更改该行?