I'm making basic "news" application in dreamviewer with Jquery Mobile.
I made all design but now its time to get the Json data from my api server into my application.
Here is my api server link ; f.e. "http:/mywebapiurl"
i think i need to write Jquery function about getJson but i dont know how to make it ?
How will i put it in to my listview with small article picture, articletitle and articleheadline ?
Here is sample of my listview which i'm going to show the news coming from Json.
<body>
<div data-role="page" id="home">
<div data-role="header">
<h1>Post Mobile</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-inset="true">
<li><a href="#headline">
<img src=ArticlePicture" class="ui-li-has-thumb"/>
<h3>ArticleTitle</h3>
<p>ArticleHeadline</p>
</a></li>
</ul>
</div>
<div data-role="footer" data-position="fixed">
<h4>© funky app </h4>
</div>
here is the code sample i tried ;
<script>
$(document).ready(function() {
$.getJSON("http://mywebapiurl", function(data) {
var result= "";
$.each(data.LatestNews, function(index, value) {
result+= "<ul><li><a href='#'><h3>"+value.TITLE+"</h3><p>"+value.SPOT+"</p></a></li></ul>";
});
$("#articleContainer").html(result);
})
});
</script>
waiting your answer.
Thank you very much.