This commit is contained in:
Anna Sudnitsina 2018-03-27 13:11:27 +03:00
parent 24c2de20b3
commit a090b00680
2 changed files with 25 additions and 23 deletions

View File

@ -1,4 +1,5 @@
var a, selected_node, deadNode, node2;
$(function() {
var url = "ws://" + location.host + "/socket";
var ws = new WebSocket(url);
@ -8,6 +9,29 @@ $(function() {
a = JSON.parse(evt.data);
displayData(a);
};
$('#mountForm').submit(function(event){
event.preventDefault();
$.ajax({
url:"mount",
data:$(this).serialize(),
method:'POST',
success:function(data){
$('#mount').css('display', 'none');
$('input[type = "text"]').val('');
var res = JSON.parse(data);
message = "<h3>" + res["state"] + "</h3> <p>"+ res["message"] +"</p>";
$("#rspContainer").css("display", "block");
$("#rsp").html(message)
if (res["state"] == 'OK'){
$("#rspContainer").css("background-color", "#4CAF50" );
}
else {
$("#rspContainer").css("background-color", "#f44336" )
}
}
})
})
$('.tablink').css('display', 'block');

View File

@ -95,28 +95,6 @@
// };
// $('.tablink').css('display', 'block');
//
var a, selected_node, deadNode, node2;
$('#mountForm').submit(function(event){
event.preventDefault();
$.ajax({
url:"mount",
data:$(this).serialize(),
method:'POST',
success:function(data){
$('#mount').css('display', 'none');
$('input[type = "text"]').val('');
var res = JSON.parse(data);
message = "<h3>" + res["state"] + "</h3> <p>"+ res["message"] +"</p>";
$("#rspContainer").css("display", "block");
$("#rsp").html(message)
if (res["state"] == 'OK'){
$("#rspContainer").css("background-color", "#4CAF50" );
}
else {
$("#rspContainer").css("background-color", "#f44336" )
}
}
})
})
</script>
</html>