What’s an API?
The acronym “API” stands for:
Application
Programming
Interface
google API
https://developers.google.com/apis-explorer/#p/
ProgrammableWeb
https://www.programmableweb.com/apis/directory
const asyncRequestObject = new XMLHttpRequest();
asyncRequestObject.open('GET', 'https://unsplash.com');
const req = new XMLHttpRequest();
undefined
req.open('GET', 'https://www.google.com/');
undefined
VM453:1 [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
function handleSuccess(){
console.log(this.responseText);
}
asyncRequestObject.onload = handleSuccess;
function handleError(){
// in the function, the 'this' value is the XHR object
console.log('An error occured');
}
asyncRequestOjbect.onerror = handleError;
function handleSuccess (){
console.log(this.responseText);
}
function handleError(){
console.log('An error occurred')
}
const asyncRequestObject = new XMLHttpRequest();
asyncRequestObject.open('GET', 'https://unsplash.com');
asyncRequestObject.onload = handleSuccess;
asyncRequestOjbect.onerror = handleError;
asyncRequestObject.send();