Merge pull request #1110 from openclassify/dia

#4231 Crud Ajax Default Type
This commit is contained in:
Fatih Alp 2021-07-08 11:26:43 +03:00 committed by GitHub
commit a9d0d80abf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 16 deletions

View File

@ -1,5 +1,6 @@
function crudAjax(params, url, type, callback = () => {}, async = false) { function crudAjax(params, url, type = 'GET', callback = () => {}, async = true, options = {}) {
return $.ajax({ return $.ajax({
...{
type: type, type: type,
data: params, data: params,
async: async, async: async,
@ -7,5 +8,7 @@ function crudAjax(params, url, type, callback = () => {}, async = false) {
success: function (response) { success: function (response) {
callback(response); callback(response);
}, },
},
...options
}); });
} }

View File

@ -1,5 +1,6 @@
function crudAjax(params, url, type, callback, async = false) { function crudAjax(params, url, type = 'GET', callback = () => {}, async = true, options = {}) {
return $.ajax({ return $.ajax({
...{
type: type, type: type,
data: params, data: params,
async: async, async: async,
@ -7,5 +8,7 @@ function crudAjax(params, url, type, callback, async = false) {
success: function (response) { success: function (response) {
callback(response); callback(response);
}, },
},
...options
}); });
} }