user group quickedit frontend and rest API

This commit is contained in:
xiaokong1937@gmail.com
2016-09-07 21:53:27 +08:00
parent 7f09b486d9
commit 04151b9957
2 changed files with 87 additions and 20 deletions

View File

@@ -153,23 +153,29 @@ function getIDall() {
return check_array.join(",");
}
function APIUpdateAttr(url, body, success, error, method) {
function APIUpdateAttr(props) {
// props = {url: .., body: , success: , error: , method: ,}
props = props || {};
$.ajax({
url: url,
type: method || "PATCH",
data: body
url: props.url,
type: props.method || "PATCH",
data: props.body,
contentType: props.content_type || "application/json; charset=utf-8",
dataType: props.data_type || "json",
}).done(function(data, textStatue, jqXHR) {
if (typeof success === 'function') {
return success(data)
if (typeof props.success === 'function') {
return props.success(data)
} else {
toastr.success('Update Success!')
}
}).fail(function(jqXHR, textStatue, errorThrown) {
if (typeof error === 'function') {
return error(errorThrown)
if (typeof props.error === 'function') {
return props.error(errorThrown)
} else {
toastr.error('Error occurred while updating.')
}
})
return true;
}
var jumpserver = new Object();