move editor ajax function to native
parent
fda5c23ae0
commit
7e27c40841
File diff suppressed because one or more lines are too long
|
@ -92,31 +92,30 @@ $(document).on('page:editor', function() {
|
||||||
var data = JSON.stringify($(this).serializeJSON()),
|
var data = JSON.stringify($(this).serializeJSON()),
|
||||||
button = $(this).find("input[type=submit]:focus");
|
button = $(this).find("input[type=submit]:focus");
|
||||||
|
|
||||||
$.ajax({
|
var request = new XMLHttpRequest();
|
||||||
type: 'POST',
|
request.open("POST", window.location);
|
||||||
url: window.location,
|
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
||||||
data: data,
|
request.setRequestHeader("X-Regenerate", button.data("regenerate"));
|
||||||
headers: {
|
request.setRequestHeader("X-Schedule", button.data("schedule"));
|
||||||
'X-Regenerate': button.data("regenerate"),
|
request.setRequestHeader("X-Content-Type", button.data("type"));
|
||||||
'X-Schedule': button.data("schedule"),
|
request.send(data);
|
||||||
'X-Content-Type': button.data("type")
|
request.onreadystatechange = function() {
|
||||||
},
|
if (request.readyState == 4) {
|
||||||
dataType: 'json',
|
if (request.status == 200) {
|
||||||
encode: true,
|
notification({
|
||||||
contentType: "application/json; charset=utf-8",
|
text: button.data("message"),
|
||||||
}).done(function(data) {
|
type: 'success',
|
||||||
notification({
|
timeout: 5000
|
||||||
text: button.data("message"),
|
});
|
||||||
type: 'success',
|
} else {
|
||||||
timeout: 5000
|
notification({
|
||||||
});
|
text: 'Something went wrong.',
|
||||||
}).fail(function(data) {
|
type: 'error'
|
||||||
notification({
|
});
|
||||||
text: 'Something went wrong.',
|
console.log(request.responseText);
|
||||||
type: 'error'
|
}
|
||||||
});
|
}
|
||||||
console.log(data);
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue