Skip to content

Commit 0d5604b

Browse files
Bugfix: correctly determine GET or POST in doAjax(), and added option to override the method
1 parent 492b1f2 commit 0d5604b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

assets/JsHelper/JsHelper.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ appJS.enableSubmit = function() {
182182
*
183183
* @param {object} args - Object where the following options are available:
184184
* - {string} url - URL of the webservice
185+
* - {string} method - Enforce this method, eg. `GET`, `POST`, etc. Otherwise if `params` has values it will be `POST`, otherwise `GET`
185186
* - {object} params - Object with parameters to send to the webservice
186187
* - {string|object} responseFormat - How to interpret the data being returned from the webservice. Available options:
187188
* - `nothing` : don't do any postprocessing as nothing is being returned, or the returned should only be processed by post-processing function
@@ -219,7 +220,7 @@ appJS.enableSubmit = function() {
219220
* - `data` : response from server
220221
* - `success` : boolean true or false based on response from server
221222
* - `doAjaxArgs` : arguments passed to the doAjax function
222-
* - {object} options - Object with nay of these options:
223+
* - {object} options - Object with any of these options:
223224
* - `confirmMessage` : set a string with message to have the user confirm before executing the AJAX call
224225
* - `skipShowProcess` : set to true to not dim the page and show process status
225226
* - `requireSsl` : set to true to require SSL for transmitting this request to the server
@@ -286,7 +287,7 @@ appJS.doAjax = function(args) {
286287

287288
var parms = {
288289
url: args.url,
289-
type: ($.isEmptyObject(args.options) ? 'GET' : 'POST'),
290+
type: (args.method ? args.method.toUpperCase() : ($.isEmptyObject(args.params) ? 'GET' : 'POST')),
290291
data: args.params,
291292
success: function(rsp, jqXHR, textStatus) {
292293
var i, functionName;

0 commit comments

Comments
 (0)