title: Getting error on $.mobile.changePage(): Uncaught TypeError: Cannot call method 'trigger' of undefined
body: <p>I have a JQM apps and I am incorporating Backbone.
  Since my initial javascript code is huge, I am only extracting what I believe is problematic. 
  I am following the advices and calls steps cited here:</p>
  
  <ul>
  <li>jqm-config.js from <a href="http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/" rel="nofollow">http://coenraets.org/blog/2012/03/using-backbone-js-with-jquery-mobile/</a></li>
  <li><a href="http://jquerymobile.com/test/docs/pages/backbone-require.html" rel="nofollow">http://jquerymobile.com/test/docs/pages/backbone-require.html</a></li>
  </ul>
  
  <p>I have a major problem, and this is the behaviour, the problem comes from this code:</p>
  
  <pre><code> var r = Backbone.Router.extend
   router: ...    
      "page": "pageDisplay"
   ...
   pageDisplay: function(){
      c = new AView();      // Backbone.View    ...fetch() data...   
      $(c.el).page();       // Call to JQM to add its extra stuff; seems done correctly
      $.mobile.changePage( "#" + c.id, {changeHash: false});       // line 50
   }
  </code></pre>
  
  <p>When following the links of <code>&lt;a href="#page" &gt;</code>, I come as expected to the 
  page "#page" properly processed.  But once there, if I click a <code>refresh</code>, which is indirectly reprocessed by the same router rule, I end up with the following error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot call method 'trigger' of undefined</p>
  </blockquote>
  
  <p>I downloaded the jquery mobile development code and observed this:</p>
  
  <blockquote>
    <p>// JQM1.1.2 - Line #3772 Show a specific page in the page container.</p>
  
  <pre><code>  $.mobile.changePage = function( toPage, options ) {
  
    if ( isPageTransitioning ) { 
       pageTransitionQueue.unshift(arguments );
       return;      
    }
    var settings = $.extend( {}, $.mobile.changePage.defaults, options);
  
    // Make sure we have a pageContainer to work with.      
    settings.pageContainer = settings.pageContainer || $.mobile.pageContainer;
    // Make sure we have a fromPage.        
    settings.fromPage = settings.fromPage || $.mobile.activePage;
                                                // Line #3788   
    var mpc = settings.pageContainer,      // Line #3789        
        pbcEvent = new $.Event("pagebeforechange" ),
        triggerData = { toPage: toPage, options: settings };
    // Let listeners know we're about to change the current page.
    mpc.trigger( pbcEvent, triggerData );      // Line #3794
  </code></pre>
  </blockquote>
  
  <p>The <code>Uncaught TypeError</code> is caused by Line #3794, because <code>mpc</code> is <code>undefined</code>.
  So, from JQM, In the Chrome inspector, I can see also that <code>settings.fromPage</code> is <code>undefined</code> and <code>settings.pageContainer</code> is <code>undefined</code>.  I kind of imagine, that JQM cannot make an assumption on the fromPage, and therefore, cannot proceed on my refresh.  All the options I have tried on the $mobile.changePage() have not succeed.  I am out of ideas.</p>
  
  <p><strong>UPDATE</strong>/  Online site with the minimum to reproduce the problem:
           apartindex, <a href="http://www.apartindex.com" rel="nofollow">access the website with the bug</a></p>
  
  <p>Any help will be appreciated.</p>