how to make a http request code example
Example 1: create http request javascript
const Http = new XMLHttpRequest();
const url='https://jsonplaceholder.typicode.com/posts';
Http.open("GET", url);
Http.send();
Http.onreadystatechange = (e) => {
console.log(Http.responseText)
}
Example 2: create http request
const xhr = new XMLHttpRequest();
let method = 'GET';
let endpoint = 'what you looking for';
xhr.open(method, endpoint);
xhr.send();
xhr.onload = () => {
'working what you get'
};