Reputation: 41
I want cancel cancel load or change page in pagebeforecreate event for jquery mobile. what jquery mobile's function can do it?
Upvotes: 4
Views: 3336
Reputation: 526
It works for me perfectly.
$.mobile.changePage( "../alerts/confirm.html", {
transition: "pop",
reverse: false,
});
Upvotes: 0
Reputation: 690
If possible for your specific use case, consider using the pagechange
event instead of the pagebeforecreate
. You can prevent the ajax request in the first place instead of using the ajax request's abort()
method. The code would look like this:
$(document).bind("pagebeforechange", function(e, data) {
// check data.toPage attribute here and decide if the pagechange should be canceled
e.preventDefault();
});
Upvotes: 2