0

I have a link in the header of my index.htm page that goes to page_02.htm. When the user reaches page_02.htm a variable is set to true. When the user returns to the index.htm from page_02 I wish to check if the variable is in fact true and dynamically update the href and text of the button in the header.

This seems like a very basic task, however I am pulling my hair out trying to figure out how to refresh the index.htm page without having to force page reload. Any ideas?

deathtrap
  • 61
  • 1
  • 2
  • Where is your variable declared? What's it scope? When you come back to index.htm from page_02, can you validate that the pageshow event is being fired? If you work out those two issues... you should be 99% of the way there. – Trent Apr 16 '12 at 15:49
  • @deathtrap, was the answer posted below helpful towards getting your answer? If so, please accept it as such. – veeTrain Apr 17 '12 at 17:38

1 Answers1

0

It looks like you could check to see if a variable is defined in pagebeforeshow and if it is then you can act upon it however you see fit.

$("#homePage").live("pagebeforeshow", function(event) {
    if (typeof some_global != 'undefined') {
        alert(some_global);
    }
});

In my secondary page, all I did was

var some_global = "Made it here";
Community
  • 1
  • 1
veeTrain
  • 2,915
  • 2
  • 26
  • 43