mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-13 21:21:03 +00:00
Update http.js
This commit is contained in:
parent
5882d8ad91
commit
adec1afd75
12
lib/http.js
12
lib/http.js
|
@ -95,16 +95,22 @@ var HTTPObject = function(engine) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.jqAjax = function(url, callback, onError) {
|
this.jqAjax = function(url, callback, onError) {
|
||||||
this.setResponseBody(window.jQuery.ajax({
|
var options = {
|
||||||
type: this.method,
|
type: this.method,
|
||||||
headers: this.headers,
|
headers: this.headers,
|
||||||
url: this.serializeParameters(url),
|
url: this.serializeParameters(url),
|
||||||
data: this.requestBody,
|
//data: this.requestBody,
|
||||||
contentType: this.contentType,
|
contentType: this.contentType,
|
||||||
success: callback,
|
success: callback,
|
||||||
async: this.isAsynchronous,
|
async: this.isAsynchronous,
|
||||||
error: onError // (request, status, error)
|
error: onError // (request, status, error)
|
||||||
}).responseText);
|
};
|
||||||
|
|
||||||
|
if (["POST", "PUT", "PATCH"].indexOf(this.method) > -1) {
|
||||||
|
options['data'] = this.requestBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setResponseBody(window.jQuery.ajax(options).responseText);
|
||||||
};
|
};
|
||||||
|
|
||||||
this.isJSONRequest = function() {
|
this.isJSONRequest = function() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user