forked from zer.ooo/web
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.
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
$(function () {
|
|
var error = $('<div class="alert alert-danger" role="alert"></div>');
|
|
|
|
$('.save').click(function () {
|
|
save(function(){});
|
|
});
|
|
|
|
$('.save-and-sign').click(function () {
|
|
save(function () {
|
|
sign();
|
|
})
|
|
});
|
|
|
|
function save(callback) {
|
|
var fingerprint = $('.server-form').data('fingerprint');
|
|
|
|
var data = $('.server-form input,.server-form select').serializeArray();
|
|
|
|
$.post('/panel/server/' + fingerprint, data, function (data) {
|
|
console.log(data);
|
|
if (!data.success) {
|
|
$('h2').after(error.text(data.error));
|
|
return;
|
|
}
|
|
|
|
callback();
|
|
}, 'json');
|
|
}
|
|
|
|
function sign() {
|
|
var fingerprint = $('.server-form').data('fingerprint');
|
|
$.post(
|
|
'/panel/server/sign',
|
|
{
|
|
fingerprint: fingerprint
|
|
},
|
|
function (data) {
|
|
if (!data.success) {
|
|
$('h2').after(error.text(data.error));
|
|
return;
|
|
}
|
|
|
|
location.reload();
|
|
},
|
|
'json'
|
|
);
|
|
}
|
|
}); |