Reputation: 131
Here is the code
var URI= "getNDealsAjax.do";
var ajN = $.getJSON(URI, function(data) {
var htmlStr = "";
$.each(data, function(i,item){
htmlStr += "<li><a href='#'>";
htmlStr += "<img src='"+item.merchantImage+"'>";
htmlStr += "</a></li>";
});
alert("htmlStr: "+htmlStr);
$('#ullink').html(htmlStr).trigger('create');
});
<div data-role="page" data-theme="a" id="demo-page" class="my-page" data-url="demo-page">
<div data-role="content">
<ul data-role="listview" id="ullink" data-inset="true">
</ul>
</div>
</div>
I used .trigger('create'); for loading the html from javascript.
Please let me know if any idea how to resolve this
Upvotes: 0
Views: 869
Reputation: 57309
If you are adding just listview content then you need to do it a little bit different:
$('#ullink').html(htmlStr).listview('refresh');
or if that throws an error use this:
$('#ullink').html(htmlStr).listview().listview('refresh');
trigger('create') should be used to enhance whole content and as such it can be used correctly only on a data-role="content"
DIV:
Upvotes: 1