function storage_create(storageType) { var str = ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += '
post
storageType:' + storageType + '
storageServer:
enable:
weight:
order:
'; $('#content').html(str); $('#post', '#content').click(function() { storage_post(storageType); }); } function storage_post(storageType) { $.ajax({ type : 'post', dataType : 'json', url : '../jaxrs/storage/storagetype/' + storageType, contentType : 'application/json; charset=utf-8', data : JSON.stringify({ enable : $('#enable').val(), weight : $('#weight').val(), order : $('#order').val(), storageServer : $('#storageServer').val() }), xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(json) { $('#result').html(JSON.stringify(json, null, 4)); }); } function storage_edit(storageType, storageServer) { $('#result').html(''); $('#content').html(''); var str = ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += ''; str += '
put
storageType:' + storageType + '
storageServer:
enable:
weight:
order:
'; $('#content').html(str); $.ajax({ type : 'get', dataType : 'json', contentType : 'application/json; charset=utf-8', url : '../jaxrs/storage/storagetype/' + storageType + '/storageserver/' + storageServer, xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(json) { $('#result').html(JSON.stringify(json, null, 4)); if (json.type == 'success') { if (json.data) { $('#storageServer').val(json.data.storageServer); $('#enable').val(json.data.enable); $('#weight').val(json.data.weight); $('#order').val(json.data.order); } } else { failure(json); } }); $('#put').click(function() { storage_put(storageType, storageServer); }); } function storage_put(storageType, storageServer) { $.ajax({ type : 'put', dataType : 'json', url : '../jaxrs/storage/storagetype/' + storageType + '/storageserver/' + storageServer, contentType : 'application/json; charset=utf-8', data : JSON.stringify({ enable : $('#enable').val(), weight : $('#weight').val(), order : $('#order').val(), storageServer : $('#storageServer').val() }), xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(json) { $('#result').html(JSON.stringify(json, null, 4)); }); } function storage_delete(storageType, storageServer) { $.ajax({ type : 'delete', dataType : 'json', url : '../jaxrs/storage/storagetype/' + storageType + '/storageserver/' + storageServer, contentType : 'application/json; charset=utf-8', xhrFields : { 'withCredentials' : true }, crossDomain : true }).done(function(json) { $('#result').html(JSON.stringify(json, null, 4)); }); }