1var xhr = new XMLHttpRequest();
2xhr.open("POST", '/url', true);
3xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
4
5xhr.onreadystatechange = function() { // Call a function when the state changes.
6 if (this.readyState === XMLHttpRequest.DONE && this.status === 200) {
7 // Request finished. Do processing here.
8 }
9}
10xhr.send("name=Hello&id=world");