嘿所有我有以下的JSON從Web服務使用AJAX來:datatables.net數據未顯示錯誤TN/4
{
"data": [
[
"11/11/2014 3:02:37 PM",
"4/13/2015 8:26:37 AM",
"032650147",
"NULL",
"Web Site Problems",
"NULL",
"New",
"6230.758742407"
],
[
...etc etc....
]
]
}
而且我動態創建HTML表所示:
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Contact Date Time</th>
<th>Last Update Date Time</th>
<th>Member ID</th>
<th>Operator NTID</th>
<th>Question</th>
<th>Redirect Email Address</th>
<th>Status</th>
<th>Receipt Date</th>
</tr>
</thead>
</table>
而且使用JavasScript,我使用,以顯示在表中返回的數據是:
$.ajax({
type: "POST",
crossDomain: true,
url: "complete.aspx/getMemberEmailsDBData",
beforeSend: function (xhrObj) {
xhrObj.setRequestHeader("Content-Type", "application/json");
},
data: {},
dataType: "json",
success: function (data) {
console.log(data.d);
$('#example').DataTable({
data: data.d,
columns: [
{ title: "ContactDateTime" },
{ title: "LastUpdateDateTime" },
{ title: "MemberID" },
{ title: "OperatorNTID" },
{ title: "QuestionArea" },
{ title: "RedirectEmailAddress" },
{ title: "Status" },
{ title: "ReceiptDate" }
]
});
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest);
}
});
加載頁面後,它不斷給我警報彈出,告訴我說:
數據表警告:表ID =例子 - 請未知參數「1」 爲行0,列1。有關更多信息,此錯誤請參閱 http://datatables.net/tn/4。
任何人看到我失蹤以解決這個問題?
什麼'的console.log(data.d); '輸出? – davidkonrad
我在上面的OP中發佈的JSON。 – StealthRT