HTML中未定义的函数错误 [英] Undefined function error in HTML
本文介绍了HTML中未定义的函数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的html代码,我得到一个Uncaught TypeError:Undefined不是函数错误访问数据表时($('#deviceTable ')。dataTable),我不知道我在html中做错了什么
Hi,
Here is my html code and I am getting an Uncaught TypeError: Undefined is not a function error While accessing the datatable ($('#deviceTable').dataTable), I dont where I am doing wrong in html
<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>
< / body>
< / html>
</body>
</html>
推荐答案
('#deviceTable')。dataTable ),我不知道我在html中做错了什么
('#deviceTable').dataTable), I dont where I am doing wrong in html
<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>
(文档).ready(function(){
var url ='http:// localhost:8080 / signalsr';
var connection =
(document).ready(function () { var url = 'http://localhost:8080/signalr'; var connection =
.hubConnection(url);
//声明代理以引用集线器。
var hubProxy = connection.createHubProxy('HubClass');
// var deviceTable =
.hubConnection(url); // Declare a proxy to reference the hub. var hubProxy = connection.createHubProxy('HubClass'); //var deviceTable =
这篇关于HTML中未定义的函数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文