mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-11 20:21:03 +00:00
Update http.js
This commit is contained in:
parent
d25a12bd8b
commit
ff00f3cf5b
52
lib/http.js
52
lib/http.js
|
@ -544,19 +544,6 @@ var HTTPObject = function(engine) {
|
|||
return this;
|
||||
};
|
||||
|
||||
this.post = function(url, callback, onError) {
|
||||
try {
|
||||
if (this.jqEnabled()) {
|
||||
this.setMethod("POST");
|
||||
this.jqAjax(url, callback, onError);
|
||||
} else {
|
||||
return this.open("POST", url).send(callback);
|
||||
}
|
||||
} catch (e) {
|
||||
if (typeof onError === "function") onError(this, null, e);
|
||||
}
|
||||
};
|
||||
|
||||
this.get = function(url, callback, onError) {
|
||||
try {
|
||||
if (this.jqEnabled()) {
|
||||
|
@ -570,6 +557,19 @@ var HTTPObject = function(engine) {
|
|||
}
|
||||
};
|
||||
|
||||
this.post = function(url, callback, onError) {
|
||||
try {
|
||||
if (this.jqEnabled()) {
|
||||
this.setMethod("POST");
|
||||
this.jqAjax(url, callback, onError);
|
||||
} else {
|
||||
return this.open("POST", url).send(callback);
|
||||
}
|
||||
} catch (e) {
|
||||
if (typeof onError === "function") onError(this, null, e);
|
||||
}
|
||||
};
|
||||
|
||||
this.patch = function(url, callback, onError) {
|
||||
try {
|
||||
if (this.jqEnabled()) {
|
||||
|
@ -583,6 +583,32 @@ var HTTPObject = function(engine) {
|
|||
}
|
||||
};
|
||||
|
||||
this.put = function(url, callback, onError) {
|
||||
try {
|
||||
if (this.jqEnabled()) {
|
||||
this.setMethod("PUT");
|
||||
this.jqAjax(url, callback, onError);
|
||||
} else {
|
||||
return this.open("PUT", url).send(callback);
|
||||
}
|
||||
} catch (e) {
|
||||
if (typeof onError === "function") onError(this, null, e);
|
||||
}
|
||||
};
|
||||
|
||||
this.delete = function(url, callback, onError) {
|
||||
try {
|
||||
if (this.jqEnabled()) {
|
||||
this.setMethod("DELETE");
|
||||
this.jqAjax(url, callback, onError);
|
||||
} else {
|
||||
return this.open("DELETE", url).send(callback);
|
||||
}
|
||||
} catch (e) {
|
||||
if (typeof onError === "function") onError(this, null, e);
|
||||
}
|
||||
};
|
||||
|
||||
this.pushState = function(state, title, url) {
|
||||
this.states.push({
|
||||
"state": state,
|
||||
|
|
Loading…
Reference in New Issue
Block a user