javascript - How can I list posts dynamically using jquery and json api? -
i want retrieve posts site web json api, , tried more codes no data displaying. problem? html:
<div data-role="page" id="searchpage" > <div data-role="header" data-position="fixed"> <h1>news</h1> </div> <div data-role="content"> <ul data-role="listview" data-inset="true" id="searchfood"></ul> </div>
js:
$(document).on("pageinit", "#searchpage", function(){ $.getjson("http://www.maan-lagh.com/?json=get_recent_posts", function(data){ var output = ''; $.each(data, function (index, value) { output += '<li><a href="#">' + value.title + '</a></li>'; }); $('#searchfood').html(output).listview("refresh"); }); });
Comments
Post a Comment