Run a function after pagecontainer change

Run a function after pagecontainer change

I'm wanting to run a function after a pagecontainer change to populate my page from a DB. I'm looking for the same functionality as .ready() in jQuery.

I've seen both load and show, but I can't get either to work. I've used the following code:

  1. function goToHome(){
  2. $(':mobile-pagecontainer').pagecontainer('change', 'index.html', {
  3. show: alert('test'),
  4.        transition: 'slide',
  5.        changeHash: true,
  6.        reverse: false,
  7.        showLoadMsg: true,
  8.        reload: false
  9.    });
  10. }

But my alert is firing before page has loaded, I get the same thing with load too.

What am I doing wrong?

Thanks in advance.