JSFiddle - React, Tailwind, and code Playground
by slawe
JavaScript
var JsonObject = {};
var http = new XMLHttpRequest();
http.open("GET", "http://gdata.youtube.com/feeds/api/videos/sfeRgbxhFgc?v=2&alt=jsonc", true); //url is the url echoing the jsonString
http.onreadystatechange = function () {
if (http.readyState == 4 && http.status == 200) {
var responseTxt = http.responseText;
myJSONObject = eval('(' + responseTxt + ')');
console.log(myJSONObject);
}
}
http.send(null);