I want to display json.articles[i].title of each news on my website here is my screenshot of website and my code:
In main.js:
(function() {
$.getJSON('https://newsapi.org/v1/articles?source=techcrunch&sortBy=top&apiKey=my-api-key', function(json) {
$("#sidebar-wrapper li").each(function() {
$('li').html(json.articles[0].titles)
});
});
})();
My HTML file :
<div id="sidebar-wrapper">
<ul class="sidebar-nav">
<strong>Latest Headines</strong>
<li>
<a href="">Your news title</a>
</li>
<li>
<a href="">Your news title</a>
</li>
<li>
<a href="">Your news title</a>
</li>
<li>
<a href="">Your news title</a>
</li>
<li>
<a href="">Your news title</a>
</li>
</ul>
</div>
Here is my screenshot of website I want to display each news title from json.articles[].title instead of "Your news title".(For clarification see screenshot and HTML code).
