Change page via Javascript
Description
The following code shows how to change page via Javascript.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.5.2.js'></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css">
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!--from w w w . j a v a 2 s .c om-->
$('#submit-button-1').click(function() {
$.mobile.changePage('#page2');
});
$('#submit-button-2').click(function() {
$.mobile.changePage('#page1');
});
});//]]>
</script>
</head>
<body>
<div data-role="page" data-theme="c" id="page1">
<div data-role="content">
<p>This is Page 1</p>
<button type="submit" data-theme="a" name="submit"
value="submit-value" id="submit-button-1">Open page 2</button>
</div>
</div>
<div data-role="page" data-theme="a" id="page2">
<div data-role="content">
<p>This is Page 2</p>
<button type="submit" data-theme="e" name="submit"
value="submit-value" id="submit-button-2">open page 1</button>
</div>
</div>
</body>
</html>