I want cancel cancel load or change page in pagebeforecreate event for jquery mobile. what jquery mobile's function can do it?
            Asked
            
        
        
            Active
            
        
            Viewed 3,332 times
        
    2 Answers
2
            
            
        If possible for your specific use case, consider using the pagechangeevent 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();
});
 
    
    
        hgross
        
- 690
- 6
- 15
0
            
            
        It works for me perfectly.
$.mobile.changePage( "../alerts/confirm.html", {
    transition: "pop",
    reverse: false,
});
 
    
    
        Community
        
- 1
- 1
 
    
    
        Prabhjot Singh
        
- 526
- 1
- 3
- 17
 
    