<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="Scripts/jquery-1.6.4.js" ></script> <script src="Scripts/jquery.signalR-2.1.2.js"></script> <script type="text/javascript" src="//cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script> <link rel="stylesheet" href="https://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css" /> <link rel="stylesheet" href="https://cdn.datatables.net/autofill/1.2.1/css/dataTables.autoFill.css" /> <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.1.js"></script> <script>"http://localhost:8080/signalr/hubs"</script> <script src="Scripts/jquery.signalR-2.1.2.min.js"></script> </head> <script> $(document).ready(function () { var url = 'http://localhost:8080/signalr'; var connection = $.hubConnection(url); // Declare a proxy to reference the hub. var hubProxy = connection.createHubProxy('HubClass'); //var deviceTable = $('#deviceTable'); hubProxy.on('DeviceDataResults', processDeviceDataResults); connection.start().done(function () { $("#GetDeviceData").click(function() { hubProxy.invoke('GetDeviceData'); }); }); function processDeviceDataResults(results) { $("#deviceTable").dataTable({ "data": results, "columns": [ { "data": "DeviceName" }, { "data": "IPAddress" } ] }); } }); </script> <body> <h1>Device List</h1> <input type="button" id="GetDeviceData" value="GetDeviceData" /> <table id="deviceTable" class="hover" cellspacing="0" width="100%"> <thead> <tr> <th>Device</th> <th>IP</th> </tr> </thead> <tfoot> <tr> <th>Device</th> <th>IP</th> </tr> <tfoot> </table>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)