crop_rotate
Run
<!DOCTYPE html> <html> <body> <h2>JavaScript Promise</h2> <p id="demo"></p> <script> function myDisplayer(some) { document.getElementById("demo").innerHTML = some; } let myPromise = new Promise(function(myResolve, myReject) { let req = new XMLHttpRequest(); req.open('GET', "mycar.html"); req.onload = function() { if (req.status == 200) { myResolve(req.response); } else { myReject("File not Found"); } }; req.send(); }); myPromise.then( function(value) {myDisplayer(value);}, function(error) {myDisplayer(error);} ); </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxib2R5Pg0KDQo8aDI+SmF2YVNjcmlwdCBQcm9taXNlPC9oMj4NCg0KPHAgaWQ9ImRlbW8iPjwvcD4NCg0KPHNjcmlwdD4NCmZ1bmN0aW9uIG15RGlzcGxheWVyKHNvbWUpIHsNCiAgZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoImRlbW8iKS5pbm5lckhUTUwgPSBzb21lOw0KfQ0KDQpsZXQgbXlQcm9taXNlID0gbmV3IFByb21pc2UoZnVuY3Rpb24obXlSZXNvbHZlLCBteVJlamVjdCkgew0KICBsZXQgcmVxID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7DQogIHJlcS5vcGVuKCdHRVQnLCAibXljYXIuaHRtbCIpOw0KICByZXEub25sb2FkID0gZnVuY3Rpb24oKSB7DQogICAgaWYgKHJlcS5zdGF0dXMgPT0gMjAwKSB7DQogICAgICBteVJlc29sdmUocmVxLnJlc3BvbnNlKTsNCiAgICB9IGVsc2Ugew0KICAgICAgbXlSZWplY3QoIkZpbGUgbm90IEZvdW5kIik7DQogICAgfQ0KICB9Ow0KICByZXEuc2VuZCgpOw0KfSk7DQoNCm15UHJvbWlzZS50aGVuKA0KICBmdW5jdGlvbih2YWx1ZSkge215RGlzcGxheWVyKHZhbHVlKTt9LA0KICBmdW5jdGlvbihlcnJvcikge215RGlzcGxheWVyKGVycm9yKTt9DQopOw0KPC9zY3JpcHQ+DQoNCjwvYm9keT4NCjwvaHRtbD4=