JavaScript
Gadgets/Demo-Sites
Java-Script Keycode
Static Code Analysis
Async-Calls
let myPromise = new Promise(function(myResolve, myReject) {
let req = new XMLHttpRequest();
req.open('GET', "<URL/API to Call>");
req.onload = function() {
if (req.status == 200) {
myResolve(req.response);
} else {
myReject("GET error");
}
};
req.send();
});
myPromise.then(
function(value) {
console.debug(value);
// Do your stuff here, gets executed after the value was returned
},
function(error) {
console.error(error);
}
);