123Ex
123Ex

Reputation: 916

Use Two pages in single html in JqueryMobile

I'm using jquery mobile with phone gap on top of the android to create a mobile application.I included two pages in single html file.It is not working as I expected.below is the code snips

<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css"/>
    <script src="JQMobile/jquery-1.9.1.min.js"></script>
    <script src="JQMobile/jquery.mobile-1.3.2.min.js"></script>
</head>
<body>
<div data-role="page" id="pageone">
    <div data-position="fixed" data-role="header" data-theme="b">
        <h1>Mobile Portal</h1>
    </div>
    <div data-role="content">
        <div class="ui-grid-a">
            <div class="ui-block-a">
                <a href="#runticketsgrid" data-role="button">Tickets</a><br>
            </div>
            <div class="ui-block-b">
                <a href="#runticketsgrid" data-role="button">Second Column</a><br>
            </div>
        </div>
    </div>
</div>
<div data-role="page" id="ticketsgrid">
    <div data-role="header">
        <h1>Page Title</h1>
    </div>
    <!-- /header -->

    <div data-role="content">
        <p>Page content goes here.</p>
    </div>
    <!-- /content -->

    <div data-role="footer">
        <h4>Page Footer</h4>
    </div>
    <!-- /footer -->
</div>
</body>
</html>

Here I want to load "ticketsgrid" page when user click the "Tickets" div but it doesn't work,Could anyone help me to find out this?

Upvotes: 0

Views: 158

Answers (2)

Ved
Ved

Reputation: 2701

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>home</title>
    <link rel="stylesheet" href="themes/style.min.css" />
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile.structure-1.3.2.min.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js">  </script>
</head>    
<body>
    <div data-role="page" id="pageone">
        <div data-position="fixed" data-role="header" data-theme="b">
            <h1>Mobile Portal</h1>
        </div>
        <div data-role="content">
            <div class="ui-grid-a">
                <div class="ui-block-a">
                    <a href="demo.html#ticketsgrid"  data-transition="slide" data-role="none">Tickets</a><br>
                </div>
                <div class="ui-block-b">
                    <a href="demo.html#ticketsgrid" data-transition="slide" data-role="none">Second Column</a><br>
                </div>
            </div>
        </div>
    </div>
    <div data-role="page" id="ticketsgrid">
        <div data-role="header">
            <h1>Page Title</h1>
        </div>
        <!-- /header -->

        <div data-role="content">
            <p>Page content goes here.</p>
        </div>
        <!-- /content -->

        <div data-role="footer">
            <h4>Page Footer</h4>
        </div>
        <!-- /footer -->
    </div>
</body>     
</html> 

Upvotes: 0

Gilly
Gilly

Reputation: 9692

Change

<a href="#runticketsgrid" data-role="button">Tickets</a><br>

to

<a href="#ticketsgrid" data-role="button">Tickets</a><br>

Same goes for the other link.

Working example: http://jsfiddle.net/9SktP/1/

Upvotes: 1

Related Questions