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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:04:31+00:00 2026-06-17T02:04:31+00:00

I am using jQuery Mobile to post through AJAX to a server. The response

  • 0

I am using jQuery Mobile to post through AJAX to a server.
The response is received as JSON which I am trying to display using a Mustache template.
Everything works but jQuery is not rendering correctly, e.g. it is not adding the class, styling etc. to the rendered template.

Loading the template and posting:

    $('#continueToHome').click(function() { // called on button click
        // call ajax, send no params, receive json
    $.post("http://localhost:3000/app_login.json", "", function(result){
        // load template
        var template = $('#personTpl').html();
        // render data into template
        var html = Mustache.to_html(template, result);
        // append to page
        $('#sampleArea').html(html);
    });
    // display page
     $.mobile.changePage( "#page-homepage", { transition: "slide"} );
    });`

The html:

    <script id="personTpl" type="text/template">
       <h1>{{first_name}} {{last_name}}</h1>
       Email: {{email}} <br> 
       <h3>Smifrs</h3> 
       <ul data-role=listview>
       {{#usmifrs}}<li><a href=#>{{name}}</a></li>
       {{/usmifrs}}</ul>
    </script>
    <div id="sampleArea"></div>

The problem is it does not display correctly.
When I have a regular ‘ul’ element with ‘data-role=listview’, jQuery injects class=’ui-listview’, divs and styles for the ‘li’ tags, but when I use my template it does not happen.

I guess I am supposed to somehow reload the page, but I can’t find how.

Thanks for your help.

  • 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-17T02:04:33+00:00Added an answer on June 17, 2026 at 2:04 am

    Just trigger the ‘create’ event on node. works for me.

    http://andymatthews.net/read/2012/05/17/Dynamically-creating-jQuery-Mobile-radio-buttons-with-Mustache

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

Sidebar

Related Questions

Currently Im trying to do ajax request using jQuery Mobile. I`m trying to use
I am trying to refresh a jQuery mobile list view after an ajax post,
i'm using jquery mobile to load from remote json the information and then put
I'm using jQuery Mobile and want to turn of Ajax handling because it does
I'm using Jquery Mobile pagination plugin and trying to work it into a plugin
I'm using jQuery Mobile and trying to figure out how to change a page
I have a login page using jQuery Mobile which contains the following code: <div
I'm using jquery mobile in a phonegap application and I'm trying to pass a
I'm using play framework and jquery mobile and trying to sum custom tag values
I'm using jQuery Validate with jQuery Mobile for a mobile application. I've been trying

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.