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

  • Home
  • SEARCH
  • 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 8510763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:47:38+00:00 2026-06-11T03:47:38+00:00

Creating app with jQuery Mobile, I want a page to load data from a

  • 0

Creating app with jQuery Mobile, I want a page to load data from a server, I’m building the list items in PHP when I load for various reasons.

So when I load a page for the first time everything goes smoothly, if I load it again the data reinserts but the markup doesn’t enhance.

There are several threads on SO adress this EXACT issue, however the accepted answer is always use .trigger(‘create’). This I have done but I’ve had no success, I’ve tried using .listview(‘refresh’), .trigger(‘updatelayout’), I’ve tried triggering these events on the page, the class for the page, the listview div, putting it in the complete: of my ajax call but nothing. So I’ve resorted to asking you community:

I’m using jQM 1.1.1: Have I missed something if you require more Info I’ll happily provide:

Here is my front page

<div data-role="page" id="frontPage">
    <div data-role="header" data-theme="e" data-id="commonHead" data-position="fixed">
        <a href="index.html" data-role="button" data-icon="home" data-iconpos="notext"></a>
        <h1>
            myApp
        </h1>
    </div>
    <div data-role="content" class="content">
        <ul data-role="listview">
            <li><a href="#" onClick="viewfList()">List</a></li>
        </ul>
    </div>
</div>

Here is the page to which I naviagate to:

<div data-role="page" id="fView">
    <div class="commonHeader"></div>
    <div data-role="content">
        <ul data-role="listview" id="fList">

        </ul>
    </div>
</div>

and here is the viewfList function I use to call the page

function viewFeatList(){
    jQuery.ajax({ //getting my new <li>
            url: 'http://sources.mysource.com/get_list.php',
            type: 'POST',
            //data: myData,
            dataType: 'jsonp',
            jsonp: 'jsoncallback',
            success: function(data, textStatus, jqXHR){     
                $('#fList').empty(); //emptying the listview                
                for (i=0;i<data.f.length;i++){
                    $('#fList').append(data.f[i]); //appending the <li>
                    }
                $('#fList').trigger('create'); //this version's attempt to re-enhance markup
                $.mobile.changePage('#fView');   //navigate to page                         

                },
            error:  function(jqXHR, textStatus, errorThrown){
                myAlert('There was an error submitting your request')
                }
            });

    }
  • 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-11T03:47:40+00:00Added an answer on June 11, 2026 at 3:47 am

    Ok thanks to inspiration from the comments, and overcoming my own negligence due to frustration I’ve found a solution:

    Here is my new function

    function viewfList(){
        jQuery.ajax({
                url: 'http://sources.mysource.com/get_list.php',
                type: 'POST',
                //data: myData,
                dataType: 'jsonp',
                jsonp: 'jsoncallback',
                success: function(data, textStatus, jqXHR){     
                    $('#fList').empty();;               
                    for (i=0;i<data.f.length;i++){
                        $('#fList').append(data.f[i]);
                        }
    
                    $.mobile.changePage('#fView');  
                    $('#fList').listview('refresh');                                            
                    },
                error:  function(jqXHR, textStatus, errorThrown){
                    myAlert('There was an error submitting your request')
                    }
                });
    
        }
    

    Turns out .listview(‘refresh’) did work and it did indeed throw out an error in the Javascript console according to CrimsonChin‘s suggestions however I was executing these on the page not the actual listview element. When I did execute it on the listview element I got this error:

    Uncaught cannot call methods on listview prior to initialization;
    attempted to call method ‘refresh’

    Which led me, obviously, to call the refresh after the page had been changed to.

    My only concern with this is: if there is alot to do on the page one day, is it possible I’ll see un-enhanced markup flash on the screen for a split second before it changes…this doesn’t happen now but i’m running a very basic page for the time being.

    Thanks for your help.

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

Sidebar

Related Questions

I am creating a mobile app using jquery mobile, PHP using JSON for fetching
I am creating an app using jQuery Mobile. I have a listview from which
I am creating an app using jQuery Mobile and PhoneGap. I delegate a button
When creating a jquery mobile / phonegap app, is it ok to pass variables
i'm creating an app in which i have a uiwebview. I want to load
I have a mobile app I am creating with JQuery Mobile. When a blackberry
I'm creating a mobile web app (not native), and I want to use the
I am creating a mobile singlepage web app using jquery mobile. The webapp includes
I am creating a web app using jQuery Mobile and PhoneGap. There is a
I'm creating an app using PhoneGap and JQuery Mobile where I expect to be

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.