Reputation: 450
I have this Javascript code:
this.confirmBox = function(data) {
$.jconfirm((function(_this) {
return function() {
var objConfig;
objConfig = $.jconfirm("getConfig");
alert("here");
return true;
};
})(this));
return false;
};
this.beforeSend = function(event, jqXHR) {
if (this.confirmBox()) {
return this.disableSubmit();
} else {
return jqXHR.abort();
}
};
When I run the script I am landing on alert("here")
and return true
for the function confirmBox.
The problem however is that the ajax call itself is not triggered anymore for some reason. How do I need to adjust the beforeSend function in order to check if the checkBox result is true or false?
Upvotes: 1
Views: 195
Reputation: 449
I think call to confirmBox method in beforeSend always returns false because $.msgbox does not block thread execution like window.confirm method does. Probably you need to invoke ajax call when you get the result === "Confirm" from message box.
$.msgbox("confirm", {
type: "confirm",
buttons: [
{ type: "cancel", value: "Cancel" },
{ type: "submit", value: "Confirm" }
]}, function(result) {
if (result === "Confirm") {
// $.ajax(..)
}
}
};
Upvotes: 1