Ajeet Pratap Maurya Ajeet Pratap Maurya - 1 year ago 55
Javascript Question

how to load an another html file on a button click in jquery mobile

I am creating an application in phonegap using the jQuery mobile framework.

In my

file I have a two text boxes to accept username and password.

When I click on the submit button it calls a function
that checks whether the username and password is correct or not and if it is correct then it should load a new html file that I have created `selectOption.html'

here is my code

<script type="text/javascript">
$(document).ready(function() {
var userName;
var userPassword;

$("#submitBtn").click(function() {
userName = $("#UserName").val();
userPassword = $("#Password").val();

if ((!UserName)|| (!userPassword)) {
alert("Enter the Details");
else {
if ((userName !="alpha") ||(userPassword !="beta")) {
alert('Enter correct username and password');
else {
//here i want to load my selectOption.html file ?

my code under

<div data-role="page" id="home">
<div data-role="header">
<h1>Enter Credential</h1>

<div data-role="content">
<label for="UserName">User Name</label>
<input type="text" name="UserName" id="UserName" value="" style="width:220px;" />

<label for="Password">Password</label>
<input type="password" name="Password" id="Password" value="" style="width:220px;" />

<div id="submitBtn" data-role="button">Submit</div>

The function is getting called but how can I load the

Answer Source

Have you tried using the jQuery Mobile method to perform navigation?



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download