Convert admin_history template to use AJAX applicator in custom.js

This commit is contained in:
Ivan Filippov
2016-04-22 19:46:02 -06:00
parent fb4d5b3f56
commit c95fd6ffec
2 changed files with 28 additions and 20 deletions

View File

@ -0,0 +1,27 @@
function applyChanges(data, url, showResult) {
var success = false;
$.ajax({
type : "POST",
url : url,
data : JSON.stringify(data),// now data come in this function
contentType : "application/json; charset=utf-8",
crossDomain : true,
dataType : "json",
success : function(data, status, jqXHR) {
console.log("Applied changes successfully.")
if (showResult) {
var modal = $("#modal_success");
modal.find('.modal-body p').text("Applied changes successfully");
modal.modal('show');
}
},
error : function(jqXHR, status) {
console.log(jqXHR);
var modal = $("#modal_error");
modal.find('.modal-body p').text(jqXHR["responseText"]);
modal.modal('show');
}
});
}