私はdatatablesの単純なajaxの例で作業していますが、動作していません。私は(私はここに表示のために少しそれをprettiedが、ファイルが改行なしで一本の長いラインである)このようになりますデータをJSON形式のデータソースを持ってAjaxのロードでDatatables.netエラー
<table id="tblAddresses">
<thead>
<tr>
<th>Street Address</th>
<th>City</th>
<th>State</th>
<th>Zip Code</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Street Address</th>
<th>City</th>
<th>State</th>
<th>Zip Code</th>
</tr>
</tfoot>
</table>
次のように私は、単純なテーブルを持っています。
{"data":[{"street":"19 Brook Avenue","city":"PASSAIC","state":"NJ","postcode":"07055"},
{"street":"27 Brook Avenue","city":"PASSAIC","state":"NJ","postcode":"07055"},
{"street":"31 Brook Avenue","city":"PASSAIC","state":"NJ","postcode":"07055"},
{"street":"35 Brook Avenue","city":"PASSAIC","state":"NJ","postcode":"07055"},
{"street":"39 Brook Avenue","city":"PASSAIC","state":"NJ","postcode":"07055"},
{"street":"49 Brook Avenue","city":"PASSAIC","state":"NJ","postcode":"07055"}]}
最後に、私は私の文書レディ機能でそれをロードします。
<script type="text/javascript">
$(document).ready(function(){
$("#tblAddresses").DataTable({
"ajax" : {
"url" : "/json/07055.json",
"columns" : [{"data":"street"},
{"data":"city"},
{"data":"state"},
{"data":"postcode"}]
}
});
});
</script>
私はページをロードすると、私は、AJAX呼び出しを参照してください。私は、ブラウザによって受け入れられたデータが、DataTableのは私にエラーを与えていることがわかります。
DataTables warning: table id=tblAddresses - Requested unknown parameter '0' for row 0, column 0.
私は、静的なデータファイルから読み込むことがないとはいえ前に、Ajaxで何度もしてきました。私はJSONまたはJavascriptでエラーを見つけることができません。
私はそれは何か愚かでしたが、私はそれを見ることができませんでした!ありがとう! –