0

我有这个 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,我需要如何更改该行?

4

1 回答 1

0

您需要将 this.beforeSend 放在确认框的 function(result)....

于 2014-09-15T11:52:51.310 回答