Jump to content



Photo

Jquery mobile, phonegap pagechange


  • Please log in to reply
No replies to this topic

#1 Craig Hopson

Craig Hopson

    Neowinian

  • Joined: 17-November 12
  • Location: London
  • OS: Windows 8 :-(

Posted 11 December 2012 - 20:32

hi i wish to get a variable from the form (page1) onsubmit switch to (page2) and display value here is what i have but i cant get it to work, i get the "alert(Device_ID); " all fine but wont redirect

<!DOCTYPE html>
    <head>
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	    <meta name="format-detection" content="telephone=no" />
	    <meta name="viewport" content="width=device-width, initial-scale=1">
	    <link rel="stylesheet" type="text/css" href="css/jquery-mobile.css" />
	    <script type="text/javascript" src="js/cordova-2.2.0.js"></script>
	    <script type="text/javascript" src="js/jquery.js"></script>
	    <script type="text/javascript" src="js/jquery-mobile.js"></script>
	    <title>CHTracker</title>
<script>
 
function LogID(Form) {
var Device_ID = Form.tracking_ID.value;
  alert(Device_ID); 
$.mobile.changePage( "#page2", { transition: "slideup"} );
   } 
</script>
   
    </head>
    <body>
	 
<!-- Start of second page -->
<div data-role="page" id="page1">
<div data-role="header">
  <h1>CHTracker</h1>
</div><!-- /header -->
<div data-role="content">
  <p>Please enter tracking ID:-</p>
	    <p>
		
	    <form method="post" data-ajax="false" onSubmit="LogID(this);">
		    <div data-role="fieldcontain">
			 <label for="tracking_ID">Tracking ID:-</label>
			 <input type="text" name="tracking_ID" id="tracking_ID" />
		    </div>   
		    <input type="submit" value="Login" />
	    </form>
   </div><!-- /content -->
<div data-role="footer" data-position="fixed">
  <h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->

<!-- Start of second page -->
<div data-role="page" id="page2">
<div data-role="header">
  <h1>CHTracker</h1>
</div><!-- /header -->
<div data-role="content">
  <p>SOMETRACKING</p>
	   
</div><!-- /content -->
<div data-role="footer" data-position="fixed">
  <h4>Page Footer</h4>
</div><!-- /footer -->
</div><!-- /page -->
			  
    </body>
</html>





Click here to login or here to register to remove this ad, it's free!