0
 <div data-role="main" class="ui-content">
    <ul data-role="listview" id="responsecontainer" >
  </ul>

This is my html file.

var output = $('#responsecontainer');   
$.ajax({
    url: 'http://192.168.1.28/mobile/db_select.php',
    dataType: 'jsonp',
    jsonp: 'jsoncallback',
    timeout: 5000,
    success: function(data, status){
        $.each(data, function(i,item){ 
            var landmark = '<li><a href="#"><h2>'+item.tr_issue+'</h2>'
            + '<p>'+item.tr_assign+'</p></a></li>';
            output.html(landmark);
            console.log(output);
        });
    },
    error: function(){
        output.text('There was an error loading the data.');
    }
});

This is my JavaScript.

I want to populate my listview from my database(mysql) but the problem is when it generates the theme of jquery mobile di not work.

enter image description here

its like a simple unordered list. thanks in advance

1 Answer 1

1

Add $('ul').listview('refresh'); after appending the HTML

Show change your success callback as below

    success: function(data, status){
        $.each(data, function(i,item){ 
            var landmark = '<li><a href="#"><h2>'+item.tr_issue+'</h2>'
            + '<p>'+item.tr_assign+'</p></a></li>';
            output.html(landmark);
            console.log(output);
        });
         $('ul').listview('refresh');
    },
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.