Home » Javascript » Listview refresh not working on dynamic

Listview refresh not working on dynamic

Posted by: admin October 18, 2018 Leave a comment

Questions:

I’ve been trying for about 10 hours now with no avail to refresh my listview through jquery.
I’m dynamically loading a list and it wont refresh to obtain the styling..
What in the flying fudge am I doing wrong.

<div data-role="content" id="content">
    <ul id="dataList" data-role="listview" data-autodividers=true" data-filter="true" data-filter-placeholder="Search..." data-inset="true" >
    </ul>
</div>

<script type="text/javascript">
$(document).ready(function(){   
    var $dataList = $("#dataList");
    $.getJSON( "starWars.json", (function( data) {
        $.each(data, function(i,item){
            $dataList.append('<li ><a href="#'+item.name+'" ><img src="images/'+item.pic+'" alt="'+item.name+'"/><h1>'+item.name+'</h1><p>'+item.about+'.</p></a></li> ');
        });
    }));
})();
</script>
Answers: