Answers for "post parameters xhr"

0

xmlhttprequest pass parameters post

xmlhttp.open("POST", "ajax.php", true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("foo=" + foo + "&bar=" + bar);
Posted by: Guest on November-05-2021
5

xhr post send

var xhr = new XMLHttpRequest();
var params = 'field1='+postfield1+'&field2='+postfield2;
xhr.open('POST', 'http://exmaple.com', true);

//Send the proper header information along with the request
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

xhr.onload = function() {//Call a function when the state changes.
    if(xhr.status == 200) {
        alert(this.responseText);
    }
}
xhr.send(params);
Posted by: Guest on July-15-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language