Javascript 您能解释一下为什么我们需要检查';删除';请求,以及为什么我们不必使用';把';要求
} this.http.send(JSON.stringify(data)); } 谢谢您提前解释! sdsds SDSDSDSJavascript 您能解释一下为什么我们需要检查';删除';请求,以及为什么我们不必使用';把';要求,javascript,callback,Javascript,Callback,} this.http.send(JSON.stringify(data)); } 谢谢您提前解释! sdsds SDSDSDS function easyHTTP() { this.http = new XMLHttpRequest(); } easyHTTP.prototype.delete = function(url, data, callback) { // BELOW IS THE <<DELETE>> REQUEST IS BEING US
function easyHTTP() {
this.http = new XMLHttpRequest();
}
easyHTTP.prototype.delete = function(url, data, callback) {
// BELOW IS THE <<DELETE>> REQUEST IS BEING USED!!!
this.http.open('DELETE', url, true);
this.http.setRequestHeader('Content-type', 'application/json');
let self = this;
this.http.onload = function() {
// BELOW WE ARE CHECKING IF THE <<HTTP.STATUS>> IS 200
if(self.http.status === 200) {
callback(null, self.http.responseText);
} else {
callback('Error: ' + self.http.status);
}
}
this.http.send(JSON.stringify(data));
}
callback(null, self.http.responseText);