Ajax : - Traditional way to make an asynchronous http request.
const http = new XMLHttpRequest();
const url = 'https://jsonplaceholder.typicode.com/todos/1';
http.open('GET', url);
http.send();
http.onreadystatechange = (data) => {console.log(data)};
JQuery Library : - You can insert jquey library script and use, $.ajax, $get, $.post methods.Fetch Api : Powerful web api returns "Promise" defined in ES6.
const url = 'https://jsonplaceholder.typicode.com/todos/1';
const httpPromise = fetch(url);
httpPromise
.then(data => { return data.json() })
.then( response => { console.log(response)});
Axios : - Open source library for making http requests
Angular HttpClient : -
Reference :
Comments
Post a Comment