Update high
This commit is contained in:
42
TeaSpeak/addons/teamspeak/js/script.js
Normal file
42
TeaSpeak/addons/teamspeak/js/script.js
Normal file
@@ -0,0 +1,42 @@
|
||||
function test(host, hash) {
|
||||
// Fork it
|
||||
var request;
|
||||
// fire off the request to /form.php
|
||||
request = $.ajax({
|
||||
url: '../modules/addons/teamspeak/lib/functions.php',
|
||||
type: 'get',
|
||||
data: {
|
||||
host: host
|
||||
},
|
||||
beforeSend: function () {
|
||||
$('.verify-status').show()
|
||||
}
|
||||
});
|
||||
// callback handler that will be called on success
|
||||
request.done(function (response, textStatus, jqXHR) {
|
||||
var status = response.status;
|
||||
var statusClass;
|
||||
if (status) {
|
||||
statusClass = 'success';
|
||||
$('#' + hash + ' span.manager').removeClass('invisible');
|
||||
} else {
|
||||
statusClass = 'danger';
|
||||
}
|
||||
|
||||
$('#' + hash).removeClass('success danger').addClass(statusClass);
|
||||
});
|
||||
// callback handler that will be called on failure
|
||||
request.fail(function (jqXHR, textStatus, errorThrown) {
|
||||
// log the error to the console
|
||||
console.error(
|
||||
"The following error occured: " +
|
||||
textStatus, errorThrown
|
||||
);
|
||||
});
|
||||
request.always(function () {
|
||||
setTimeout(function () {
|
||||
$('.verify-status').hide();
|
||||
}, 2000);
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user