I don't know why the process ignores my AJAX call. It simply jumps from console.log("1");
to console.log("2");
.
Can someone explain to me what is going wrong?
render: function() {
let view = this;
component.prototype.render.call(view);
console.log("1");
$.ajax = ({
type: "GET",
cache: false,
url: "news.json",
dataType: "json",
success: function(json) {
console.log("success");
for (let i = 0; i < json.length; i++) {
let news = modelNews;
news.title = json[i].title;
news.type = json[i].type;
news.img = json[i].img;
news.link = json[i].link;
view.$('#newsfeed').append(news.getNewsFeedLook());
}
},
error: function() {
console.log("error");
}
});
console.log("2");
}