I am trying to take this api: https://newsapi.org/v1/articles?source=techcrunch&sortBy=top&apiKey=9a9c9037fecf4bcb9e49ffa581f8713b and assign it to a variable in JS where if i console.log(variable) inside of a console of a browser it will give me a tree pertaining to the api. This is probably a horrible explanation, so here's a picture of what i'm looking to get: https://imgur.com/a/nhJU5
Barren Code: https://imgur.com/a/Nq7gS src=' https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js ' in HTML I used this Yahoo YQL in previous RSS apps I've made but clearly it doesn't work the same on this one
var variable;
function reqListener () {
variable=oReq.response;
console.log(variable);
}
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.responseType="json";
oReq.open("GET", "https://newsapi.org/v1/articles?source=techcrunch&sortBy=top&apiKey=9a9c9037fecf4bcb9e49ffa581f8713b");
oReq.send();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.