diff --git a/lib/http.js b/lib/http.js index 3547fb2..3b41e18 100644 --- a/lib/http.js +++ b/lib/http.js @@ -95,16 +95,22 @@ var HTTPObject = function(engine) { }; this.jqAjax = function(url, callback, onError) { - this.setResponseBody(window.jQuery.ajax({ + var options = { type: this.method, headers: this.headers, url: this.serializeParameters(url), - data: this.requestBody, + //data: this.requestBody, contentType: this.contentType, success: callback, async: this.isAsynchronous, 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() {