“XHR Post Wyślij” Kod odpowiedzi

xmlhttp js żądanie postu

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");
Gigas

XHR Post Wyślij

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);
Splendid Shrew

Odpowiedzi podobne do “XHR Post Wyślij”

Pytania podobne do “XHR Post Wyślij”

Więcej pokrewnych odpowiedzi na “XHR Post Wyślij” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu