Answers for "xhr request payload"

0

xmlhttp js post request

var xhr = new XMLHttpRequest();
xhr.open("POST", '/url', true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.onreadystatechange = function() { // Call a function when the state changes.
    if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
        // Request finished. Do processing here.
    }
}
xhr.send("name=Hello&id=world");
Posted by: Guest on May-26-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language