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 8001267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:03:00+00:00 2026-06-04T16:03:00+00:00

I have an ASP.Net MVC3 application (it doesn’t matter if it is ASP.NET MVC,

  • 0

I have an ASP.Net MVC3 application (it doesn’t matter if it is ASP.NET MVC, PHP or RAILS coz in the end it is serving out plaing HTML) which is using jquery mobile and works great in all mobile browsers.
The next step for me is to create a native ios app using Phonegap.

My guess is all I have to do is in the html page which I put in Phonegap, I will hook into page load event and dynamically load the contents of my MVC view from a remote server.

But I am looking for some examples if anyone else has done something similar.

-Thanks in advance
Nick

UPDATE: I was able to accomplish this by writing the following index.html page. Hope it helps someone else.

STILL ISSUES THOUGH : But having done this…as you may notice I am requesting my ASP.NET MVC page via http://IP:8081 URL. This works fine and it loads my page too…but it is not jquery mobile formatted. So, if someone can help me out here, it will be great.

EXPLANATION : Since, the ajax.responseText contains the entire HTML starting from the <!DOCTYPE html> tag… I think it is pretty obvious that I end up inserting an entire HTML page inside my <div data-role="page" id="home"> tag which is obviously wrong but I don’t have a solution for it yet 🙁

<!DOCTYPE html>
<html>
<head>
    <title>PhoneGap Ajax Sample</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, target-densityDpi=device-dpi"/>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
    <script type="text/javascript"  src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script type="text/javascript"  src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
    <script type="text/javascript">
        function onDeviceReady() {
            var ajax = new XMLHttpRequest();
            ajax.open("GET", "http://192.168.2.30:8081/", true);
            ajax.send();

            ajax.onreadystatechange = function () {
                alert(ajax.status);
                if (ajax.readyState == 4 && (ajax.status == 200 || ajax.status == 0)) {
                    document.getElementById('home').innerHTML = ajax.responseText;
                }
            }
        }

        $(document).bind("mobileinit", function () {
            alert('mobileinit');
            // Make your jQuery Mobile framework configuration changes here!
            $.support.cors = true;
            $.mobile.allowCrossDomainPages = true;
        });

        document.addEventListener("deviceready", onDeviceReady, false);
    </script>
</head>
<body>
     <div data-role="page" id="home"> 
     </div>
     <div data-role="page" id="search"> 
     </div>
     <div data-role="page" id="recent"> 
     </div>
</body>
</html> 
  • 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-04T16:03:01+00:00Added an answer on June 4, 2026 at 4:03 pm

    Why not use jQuery helpers to load the page from the remote server.

    $(document).bind("mobileinit", function () {
         alert('mobileinit');
         // Make your jQuery Mobile framework configuration changes here!
         $.support.cors = true;
         $.mobile.allowCrossDomainPages = true;
         $("#home").load('http://192.168.2.30:8081/ #targetContent');
    });
    

    the load method can make a request and replace the contents of the selector with the results from the ajax request. It also allows you to provide a selector after the URL which will target specific content from the remote server you want to load into the original matched selector.

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

Sidebar

Related Questions

I have a ASP.NET MVC3 application that handles time-consuming processes (copying a large file
I am creating an ASP.NET MVC3 application using NHIBERNATE. I have a base class
This is about asp.net mvc3 web application. We have used Object cache to store
I have an ASP.NET MVC 3 application which has a post action called Create
I have an ASP.NET MVC 3 application (in IIS 7.5) with a portable area.
We have a Asp.net MVC 3 application with 3 areas, Unity dependency injection, about
I have an ASP.NET MVC 3 application. This application requests records through jQuery. jQuery
I used to have a standard ASP.NET MVC 3 application that was Ninject-wired via
I have created blank Asp.Net-MVC 3 web application and want to write my own
I am working on an asp.net MVC 3 application. I have a C# function

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.