$(".ip_dropdown").change(function (){ $(".modal.show .btn").removeAttr("disabled") }); $(".conf_dropdown").change(function (){ $(".modal.show .ip_dropdown").html('Loading...') $.ajax({ url: "/get_ping_ip", method: "POST", data: "config="+$(this).children("option:selected").val(), success: function (res){ $(".modal.show .ip_dropdown").html("") $(".modal.show .ip_dropdown").append('Choose an IP') $(".modal.show .ip_dropdown").append(res) } }) }); // Ping Tools $(".send_ping").click(function (){ $(this).attr("disabled","disabled") $(this).html("Pinging...") $("#ping_modal .form-control").attr("disabled","disabled") $.ajax({ method:"POST", data: "ip="+$(':selected', $("#ping_modal .ip_dropdown")).val()+"&count="+$("#ping_modal .ping_count").val(), url: "/ping_ip", success: function (res){ $(".ping_result tbody").html("") html = 'Address'+res['address']+'' + 'Is Alive'+res['is_alive']+'' + 'Min RTT'+res['min_rtt']+'ms' + 'Average RTT '+res['avg_rtt']+'ms' + 'Max RTT'+res['max_rtt']+'ms' + 'Package Sent'+res['package_sent']+'' + 'Package Received'+res['package_received']+'' + 'Package Loss'+res['package_loss']+'' $(".ping_result tbody").html(html) $(".send_ping").removeAttr("disabled") $(".send_ping").html("Ping") $("#ping_modal .form-control").removeAttr("disabled") } }) }); // Traceroute Tools $(".send_traceroute").click(function (){ $(this).attr("disabled","disabled") $(this).html("Tracing..."); $("#traceroute_modal .form-control").attr("disabled","disabled") $.ajax({ url: "/traceroute_ip", method: "POST", data: "ip="+$(':selected', $("#traceroute_modal .ip_dropdown")).val(), success: function (res){ $(".traceroute_result tbody").html(""); for (i in res){ $(".traceroute_result tbody").append(''+res[i]['hop']+''+res[i]['ip']+''+res[i]['avg_rtt']+''+res[i]['min_rtt']+''+res[i]['max_rtt']+'') } $(".send_traceroute").removeAttr("disabled"); $(".send_traceroute").html("Traceroute"); $("#traceroute_modal .form-control").removeAttr("disabled") } }) })