Can a JavaScript HTTP POST request be made to any domain?
Javascript
var xhr = new XMLHttpRequest();
xhr.open("POST", 'URL link', true);
// Include proper header information with the request
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() { // Execute a function when the state changes.
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
// Request completed. Perform processing here.
}
}
xhr.send("foo=bar&lorem=ipsum");
// xhr.send(new Int8Array());
// xhr.send(document);
and I want it to be displayed on the screen. Is this achievable?