Mario
Mario

Reputation: 2739

Jquery mobile cancel page change

I need to be able to cancel a page change event depending on a boolean value.

as you can see here JsFiddle If you click next page while isOk is false it will not let you go. But if you then change it to true it will still not let you go, it's like it's stuck or something.

I know how abort works in jquery when you have like

var change = (Ajax stuff)
change.abort();

but i'm not to sure how it works in jquery mobile since the ajax is done for you

Upvotes: 2

Views: 677

Answers (1)

user700284
user700284

Reputation: 13620

How about using changePage method for changing pages instead of making use of href attribute?.So basically you will be doing this - Check for value of isOk in the anchor click handler.If isOk is true call the changePage method and load the new page.Otherwise show alert.

Here is the updated fiddle - http://jsfiddle.net/bKcGd/7/

Let me know if that helps.

Upvotes: 3

Related Questions