I'm having a few issues appending a News API into my HTML. It has worked previously for me using the Guardian API, however, the one I'm trying to add now has images in it.
HTML
<div class="tab-pane fade" id="politics">
<h3>POLITICS</h3>
<p id="politics_news"></p>
</div>
jQuery
$(document).ready(function()
{
$.ajax(
{
type: "GET",
dataType: "jsonp",
cache: false,
url: "https://newsapi.org/v2/top-headlines?sources=cnn&apiKey=XXXXXX",
success: function(data)
{
for (var i = 0; i < 5; i++)
{
$("#politics_news").append("<div class='cnn'><a target='_blank' href='" + data.response.results[i].url + "'>" + data.response.results[i].title + " | " + "</a></div>");
$("#politics_news").append("<img class='cnn_img'><a target='_blank' href='" + data.response.results[i].urlToImage "</a></img>");
$("#politics_news").append("<br />");
}
console.log(data);
}
})
});
Any help on this would be much appreciated.