Hey I used the following function to load a page using Jquery mobile
$.mobile.changePage( "http://localbhost:8080/Chat.htm", { transition: "slideup"} );
On the page loaded, Chat.htm, I am trying to call some javascript but it is not working. I am trying to use the code below to execute some JS. I also tried the pageload, pageinit and pagecreate, but none of them worked. I also tried
$(function(){
// code
});
jQuery(document).live('pagebeforeload',function(event){
// code to execute
}
So is there some event in JQM, which could catch a page transition event, or there some other way I could call JS on the new loaded page.
It doesn’t work like that. By default JQueryMobile is going to fetch your page via AJAX and insert it into the dom. Any JS that’s on the loaded page is not going to get parsed. You want to listen for the
pageshowevent and put your code there. Example:See this for more information:
http://jquerymobile.com/demos/1.2.0/docs/pages/page-navmodel.html