title: jquerymobile session timeout with 2 timers
body: <p>Edit: I see the issue is with using live instead of on. I fixed that however, can't get the second timer to fire.. </p>
  
  <p>Error: <code>Object [object Object] has no method "popup"</code></p>
  
  <p>I am trying to implement a client side session time out using jquery mobile. My code is at: <a href="http://jsfiddle.net/83BSW/5" rel="nofollow">http://jsfiddle.net/83BSW/5</a> </p>
  
  <p>Appreciate any insights.. </p>
  
  <p>Here is the code for convenience:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt; 
  &lt;head&gt; 
      &lt;title&gt;My Page&lt;/title&gt; 
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; 
      &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" /&gt;
      &lt;script src="http://code.jquery.com/jquery-1.7.1.min.js"&gt;&lt;/script&gt;
      &lt;script src="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.js"&gt;&lt;/script&gt;
  
  
  &lt;!-- Application specific --&gt;
  
  &lt;script&gt; 
  var first_timer = 2 * 1000;
  var second_timer = 3 * 1000;
  var down = -1;
  
  function initTimer() {
    down = setTimeout(processTimeout, first_timer)
  }
  
  function processTimeout() {
          down = setTimeout(logout, second_timer);
          $.mobile.changePage('#timeout1',{transition:'slide', role:'dialog'});
          //alert ("Timeout of first timer, timerid:" + down );
  }
  
  function logout() {
      $("#timeout").popup('close');
    $.mobile.changePage('#timeout2',{transition:'slide', role:'dialog'});
    alert("You are logged out");
  //  window.location = "http://www.google.com"
  }
  
  function resetMyTimer() {
    if ( -1 != down )
      clearTimeout(down);
    alert("Restarting timer");
    initTimer();
  }
  
  $("#loadingpage").on(function() {
      resetMyTimer();
  });
  
  initTimer();
  
  &lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div data-role="page" id="loadingpage"&gt;
    &lt;div data-role="header" data-position="fixed"&gt; 
        &lt;div class="headerlogo"&gt; &lt;/div&gt;
        &lt;h1&gt; Test &lt;/h1&gt;
    &lt;/div&gt; 
    &lt;div data-role="content" &gt;
      &lt;div id="ssagov"&gt; 
      &lt;h1&gt; Hi there &lt;/h1&gt;
      &lt;/div&gt; 
      &lt;input type="button" data-shadow="false" data-corners="false" value="Next"  /&gt;
    &lt;/div&gt;&lt;!-- /content --&gt; 
  &lt;/div&gt;&lt;!-- /launch page --&gt;
  &lt;div data-role="page" id="timeout1" data-role="popup"&gt;
    &lt;div data-role="header" data-backbtn="false"&gt;
      &lt;h1&gt;Timeout1&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div data-role="content"&gt;
      Your session will timeout in 2 mins.
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div data-role="page" id="timeout2" data-role="popup"&gt;
    &lt;div data-role="header" data-backbtn="false"&gt;
      &lt;h1&gt;Timeout2&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div data-role="content"&gt;
      Your session has timed out
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;​
  </code></pre>