none
/**post**/
var request = new XMLHttpRequest();
request.open('POST', '/my/url', true);
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
request.send(data);
/**request**/
var request = new XMLHttpRequest();
request.open('GET', '/my/url', true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
// Success!
var resp = request.responseText;
} else {
// We reached our target server, but it returned an error
if (request.status == 400) {
alert('There was an error 400');
}
else {
alert('something else other than 200 was returned');
}
}
};
request.onerror = function() {
// There was a connection error of some sort
};
request.timeout = 10000
request.ontimeout = function(){
}
request.onprogress = function(e){
if(e.lengthComputable){
e.position
e.totalSize
}
}
request.send();