1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- /*
- ui.js
-
- */
- function cjax(object){
- let csrf_token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
- $.ajax({
- url: object.url,
- type: object.type || 'POST',
- data: object.data || {},
- headers: {
- 'X-CSRF-Token': csrf_token
- },
- success: object.success,
- error: object.error
- });
- }
- // Add cjax as a jQuery method
- $.cjax = cjax;
- function switchMassStorageToRemote(){
- $.cjax({
- url: '/aux/switchusbremote',
- type: 'GET',
- success: function(response) {
- //alert('Mass Storage switched to Remote successfully.');
- },
- error: function(xhr, status, error) {
- alert('Error switching Mass Storage to Remote: ' + error);
- }
- });
- }
- function switchMassStorageToKvm(){
- $.cjax({
- url: '/aux/switchusbkvm',
- type: 'GET',
- success: function(response) {
- //alert('Mass Storage switched to KVM successfully.');
- },
- error: function(xhr, status, error) {
- alert('Error switching Mass Storage to KVM: ' + error);
- }
- });
- }
|