<!DOCTYPE html>
<html>
<head>
    <title>iPerf3 Web Interface</title>
    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
    <script>
        $(document).ready(function() {
            var output = $('#output');
<pre><code>        function appendOutput(data) {
            output.append(data + '\n');
        }

        $('#start').click(function() {
            $.ajax({
                url: '/start',
                type: 'POST',
                success: function(response) {
                    output.empty();
                    output.text('Command started.');
                    var source = new EventSource('/stream');
                    source.onmessage = function(event) {
                        appendOutput(event.data);
                    };
                }
            });
        });

        $('#stop').click(function() {
            $.ajax({
                url: '/stop',
                type: 'POST',
                success: function(response) {
                    output.text('Command stopped.');
                }
            });
        });
    });
&lt;/script&gt;
</code></pre>
</head>
<body>
    <h1>iPerf3 Web Interface</h1>
    <button id="start">Start Command</button>
    <button id="stop">Stop Command</button>
    <pre id="output"></pre>
</body>
</html>
iPerf3 Web Interface - Monitor Network Bandwidth

原文地址: http://www.cveoy.top/t/topic/qx9N 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录