javascript - jquerymobile - pagecontainer doesnt fire consistently -


i have 2 html pages (jquerymobile ver 1.4.5)

index.html

            $.when( $.ajax({                     url: '/login',                      data: {username:u, password:p},                     contenttype:'application/json',                     type: 'post',                     datatype: 'json'                  })             ).then(function( data, textstatus, jqxhr ) {                 if(data.status == success) {                     $(":mobile-pagecontainer").pagecontainer("load", "home.html"); //<-- doesnt work always.                  } else {                     showmessage(data.message, 'error');                 }             }); 

the $(":mobile-pagecontainer").pagecontainer code doesnt work consistently. when run in phonegap build, shows

[phonegap] 200 /home.html [phonegap] 200 /img/logo.png [phonegap] 200 /__api__/autoreload 

but page on screen still showing index.html

when reloads home.html, have logout button. when user clicks that, have same problem redirecting index.html

basically load
load data server , place returned html matched element.
may not load data local.
can use 'change' instead of 'load' follows,
$( ":mobile-pagecontainer" ).pagecontainer( "change", "test.html", { transition: "slide" } );


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -