Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8557047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:29:11+00:00 2026-06-11T15:29:11+00:00

I am developing an application by using phonegap and jQuery Mobile. Phonegap recommends a

  • 0

I am developing an application by using phonegap and jQuery Mobile. Phonegap recommends a single document structure. As 5 divs or more in a document are pretty unclear, I’m trying to split up my pages (the div’s) into multiple documents. As soon as phonegap loads the app, I want to insert these documents into the index.html.

function loadPage(external_document) {
    var docname=external_document+".html";
    $.get(docname, function(data) {
        console.log(docname+" loading");
        $("body").append($(data).find("body"));
        $("head").append($(data).find("head"));
        console.log(docname+" loaded");
    });

}

document.addEventListener("deviceready", function(){
    loadPage("DialogCredentials");
}, false);

DialogCredentials.html

<html>
<head>
     <script type="text/javascript" src="js/DialogCredentials.js"></script>
</head>
<body>  
    <div data-role="page" id="dlg_credentials">
    <div data-role="header"><h1>Login</h1></div>
    <div data-role="content">
    ... 
</div>
</div><!-- /page -->
</body>
</html>

As soon as the loadPage gets executed there should be a <div id="dlg_credentials"… and the corresponding javascript tag in the dom of my main document. But it isn’t. There are no errors shown in the web inspector.
So what am I doing wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:29:12+00:00Added an answer on June 11, 2026 at 3:29 pm

    Without setting up a test case for you, if you really want to separate your pages to make your coding easier I would recommend to load the pages the standard way for jQuery Mobile i.e.

    $.mobile.changePage( "about/us.html", { transition: "slideup"} );
    

    This way you aren’t reinventing the wheel and it satisfies your request. The overhead will be negligible compared to your proposed solution in any case let alone taking into account you want the first page to render quickly rather than to be blocked by inserting many pages before any html is rendered in any case. Since they will be local on the device in any case Phonegap will be able to serve them very quickly.

    One thing to remember when loading pages through jQuery Mobile is that it strips out anything in the target page outside of the

    data-role="page|dialog|popup"
    

    tag and therefore to load custom page-specific javascript I would recommend you include the script tag directly below the

    data-role="page"
    

    opening tag and set any page initialization to occur on “pageinit”

    <div data-role="page" id="options" data-theme="a">
    <script type="text/javascript">
        $(document).bind('pageinit', initializeOptions());
        function initializeOptions() {
            // do your page initialization here . . . 
        }
    </script>
    <!-- rest of page continues here . . . . -->
    

    and then continue with the rest of your page as needed. That way it will be parsed when the page is loaded via the $.mobile.changePage method.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application using jQuery mobile 1.1.0 RC1 and phonegap 1.5.0 I
I am developing an application using PhoneGap and jQuery Mobile. Now when the page
Im developing a mobile application using phonegap and jquery mobile. I created the layout
I am developing a mobile application using phonegap and jquery mobile. I have this
I'm developing an application using jQuery Mobile, Phonegap. The function below I get data
I am developing a mobile application using Jquery mobile framwork & phonegap. So, I
I am developing a PhoneGap application with JQuery mobile which requires geolocation data. Currently
I am developing an app using phonegap for Android. I want this mobile application
I am developing a mobile application in android using eclipse and phonegap. and my
I am developing a application for Android using PhoneGap. I am trying to insert

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.