0

Am trying to refresh a page on pageshow in jquery mobile

Tried code:

$(document).on("pageshow","#schoolperformance", function(){ 
showLoadMsg : false,
reloadPage : true,
});

But i keep on getting an error of unexpected token which points to the part{ reload page:true} when viewing in the console

Geoff
  • 6,277
  • 23
  • 87
  • 197
  • You have 2 mistakes in your code. A) You have a comma too much. (The one at the end of line 4.) B) The third parameter is a function, not an array. This code thus also trigger errors after "*fixing*" it. – CerebralFart Mar 14 '16 at 05:40

1 Answers1

1

Consider the use of pagecontainers (http://api.jquerymobile.com/pagecontainer/#method-change).

For instance:

$( ":mobile-pagecontainer" ).pagecontainer( 
    "change", 
    "#schoolperformance", 
    { reload : true, showLoadMsg : false } 
);
Gjermund Dahl
  • 1,410
  • 17
  • 25
  • fyi; `reload/reloadPage: true` works only with URLs. – Omar Mar 16 '16 at 16:35
  • What about passing a function on the change page example: $.ajax(..) that is after changing the page – Geoff Mar 21 '16 at 08:24
  • That is doable. This thread provides great information about page events: http://stackoverflow.com/questions/14468659/jquery-mobile-document-ready-vs-page-events – Gjermund Dahl Mar 27 '16 at 10:01