You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
JavaScript
51 lines
1.2 KiB
JavaScript
8 years ago
|
$(function () {
|
||
8 years ago
|
var errorDiv = $('<div>').addClass('error-message');
|
||
|
|
||
|
function error(msg) {
|
||
|
$('.title').after(errorDiv.text(msg));
|
||
|
}
|
||
8 years ago
|
|
||
|
$('.save').click(function () {
|
||
|
save(function(){});
|
||
|
});
|
||
|
|
||
|
$('.save-and-sign').click(function () {
|
||
|
save(function () {
|
||
|
sign();
|
||
|
})
|
||
|
});
|
||
|
|
||
|
function save(callback) {
|
||
|
var fingerprint = $('.server-form').data('fingerprint');
|
||
|
|
||
8 years ago
|
var data = $('.server-form input,.server-form select').serializeArray();
|
||
8 years ago
|
|
||
|
$.post('/panel/server/' + fingerprint, data, function (data) {
|
||
|
if (!data.success) {
|
||
8 years ago
|
error(data.error);
|
||
8 years ago
|
return;
|
||
8 years ago
|
}
|
||
|
|
||
|
callback();
|
||
8 years ago
|
}, 'json');
|
||
8 years ago
|
}
|
||
|
|
||
|
function sign() {
|
||
|
var fingerprint = $('.server-form').data('fingerprint');
|
||
|
$.post(
|
||
|
'/panel/server/sign',
|
||
|
{
|
||
|
fingerprint: fingerprint
|
||
|
},
|
||
|
function (data) {
|
||
|
if (!data.success) {
|
||
8 years ago
|
error(data.error);
|
||
8 years ago
|
return;
|
||
8 years ago
|
}
|
||
8 years ago
|
|
||
|
location.reload();
|
||
|
},
|
||
|
'json'
|
||
8 years ago
|
);
|
||
|
}
|
||
|
});
|