yuuki/libs/webadmin/static/js/index.js
SuperSonic 102739a400 Update
2020-02-08 15:05:09 +08:00

37 lines
No EOL
946 B
JavaScript

/*jshint esversion: 6 */
/*
Yuuki_Libs
(c) 2020 Star Inc.
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function init(id, data) {
$.ajax({
url: "/api",
type: "POST",
data: {
task: "get_logs",
data: data
},
error: function () {
$(id).text("Something was wrong.");
},
success: function (response) {
let ajax_result = response.result;
if (ajax_result.length)
$(id).text(ajax_result[ajax_result.length - 1]);
else
$(id).text("Nothing");
}
});
}
$(function () {
init("#Join_Event", "JoinGroup");
init("#Kick_Event", "KickEvent");
init("#Cancel_Event", "CancelEvent");
init("#Block_Event", "BlackList");
});