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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:26:53+00:00 2026-06-02T04:26:53+00:00

Im going through a serious headache, for the last few hours I cant figure

  • 0

Im going through a serious headache, for the last few hours I cant figure out why when I flick between pages (dynamically loaded by ajax) that the styling all goes.

I have read dozens of posts on the net about this, and have tried .page() trigger(“Refresh”) trigger create and many more.

Page 1 has a list, on click of the item it fetches the complete contents of another list and put them into the DOM.

JQuery Versions (mobile 1.1rc2 – but same issue with 1.0.1 stable):

<script src="scripts/ajax.js"></script>
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.css">

This link is clicked on initial list:

javascript:GetGarageList("G9236")

which triggers :

// show garages for factor
function GetGarageList(accNo) {
    $.mobile.showPageLoadingMsg("b", "Loading", false);
    $.ajax({
        type: "POST",
        url: "Default.aspx/GetGarageList",
        data: "{'accNo':'" + accNo + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            $("#garageList").html(msg.d);
            $.mobile.changePage("#garageList");
        },
        error: function () {
            ShowError("Error :(");
        },
        complete: function () {
            $.mobile.hidePageLoadingMsg();
        }
    });
};

On first load, the 2nd page looks perfect :

enter image description here

But when I press back button up top. Then click another link :

javascript:GetGarageList("G9336")

I get messed up view :

enter image description here

Please help!

EDIT :

Others have used .trigger(“create”); and say they solved the problem… but everytime I add that to my code like so :

$("#garageList").html(msg.d).trigger("create");

or

$("#garageList").html(msg.d);
$("#garageList").trigger("create");

It just gives me a loading spinner forever.

EDIT 2:

As per Barnes suggestion below I have changed the html as so :

    <%--Garage List--%>
    <div data-role="page" id="garageList" data-add-back-btn="true" data-theme="a">
        <div data-role='header' data-position='fixed'>
            <h1>Garages</h1>
            <a href='index.html' data-icon='plus' data-iconpos='notext' class='ui-btn-right' data-theme='b'></a>
        </div>
        <div data-role='content' id="abc">
            <ul data-role='listview' id='xyz' data-filter='true' data-filter-theme='a' data-filter-placeholder='search name or account no...' data-split-icon='info' data-split-theme='a'>

/// --> new content goes here... as simply many <li> items.

</ul>
        </div> <!-- /content -->
    </div> <!-- /page -->

Then I tried (in the ajax success):

            $("#xyz").empty();
            $("#xyz").html(msg.d);
            $("#abc").listview("refresh");
            $.mobile.changePage("#garageList");

AND

            $("#xyz").html(msg.d);
            $("#xyz").listview("refresh");
            $.mobile.changePage("#garageList");

HERE is some sample output of msg.d :

"<li><a href='javascript:GetGarageDetails(16267)'><h3>A KETCHEN MOTOR ENGINEERS</h3><p><strong>MID LOTHIAN</strong></p></a><a href="javascript:GetFactorDetails('16267')"></a></li>

<li><a href='javascript:GetGarageDetails(16328)'><h3>G.A.AUTOS</h3><p><strong></strong></p></a><a href="javascript:GetFactorDetails('16328')"></a></li>

<li><a href='javascript:GetGarageDetails(16262)'><h3>GARRY HENDERSON MOTOR ENGINEERS</h3><p><strong>WEST LIMTON</strong></p></a><a href="javascript:GetFactorDetails('16262')"></a></li>

<li><a href='javascript:GetGarageDetails(16264)'><h3>LEADBURN GARAGE LTD</h3><p><strong>PEELBLESHIRE</strong></p></a><a href="javascript:GetFactorDetails('16264')"></a></li>

<li><a href='javascript:GetGarageDetails(16315)'><h3>LOTHIAN MOTORS</h3><p><strong></strong></p></a><a href="javascript:GetFactorDetails('16315')"></a></li>

"

And other variations, but it still doesnt want to play (spinner goes on forever on refresh) … although its improved a little (when I take the refresh out) :

enter image description 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-02T04:26:55+00:00Added an answer on June 2, 2026 at 4:26 am

    This has been solving all of my problems.

    $('...').trigger('create');
    

    You just have to find the right element to put in the selector.

    For me, these lines did the trick:

    $(document).bind('pagechange', function() {
      $('.ui-page-active .ui-listview').listview('refresh');
      $('.ui-page-active :jqmData(role=content)').trigger('create');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While going through the last edits of the C++0x Working draft I found a
I'm having a serious dispute with NSNumberFormatter, and even after going through its extensive
Going through happstack-lite tutorial : we build functions that have return type of ServerPart
Going through some of my older Delphi projects and upgrading them to D2009, as
Going through Javascript documentation, I found the following two functions on a Javascript object
Going through the microsoft authentication tutorial listed here they have you create a master
Going through some documentation on modifying CGImageRef data, I came across a strange example
While going through SWig generated wrappers, I find that the PInvokes don't have any
While going through some tutorials, I have encountered lines such as this: ((IDisposable)foo).Dispose(); Ignore
While going through many resources on multithreaded programming, reference to volatile specifier usually comes

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.