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
How about using
changePagemethod for changing pages instead of making use ofhrefattribute?.So basically you will be doing this – Check for value ofisOkin theanchorclickhandler.IfisOkis true call thechangePagemethod and load the new page.Otherwise show alert.Here is the updated fiddle – http://jsfiddle.net/bKcGd/7/
Let me know if that helps.