【发布时间】:2014-02-17 22:35:05
【问题描述】:
我正在使用 DataTable 1.7.5 和 JQuery-1.7.1.min.js 并收到 JSON 解析错误。在浏览几个在线论坛时,建议升级 JQuery-1.5.1.min.js 的验证器插件,但对 JQuery-1.7.1.min.js 的验证器一无所知。是否有人对此问题有任何建议?
Table HTML:
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example" >
<thead>
<tr>
<th>#</th>
<th></th>
<th>Name</th>
<th>Shpr</th>
<th>Org</th>
<th>Cne</th>
<th>Dest</th>
<th>Dep Dt</th>
<th>LR No</th>
<th>Asset No</th>
<th>Curr Dt</th>
<th>Spd km/h</th>
<th>Waypoint1</th>
<th>Waypoint2</th>
<th>SDA</th>
<th>DETA</th>
<th>AMC</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
Javascript:
var oTable = $('#example').dataTable({
"aLengthMenu" : [[-1, 10, 25, 50, 100], ["All", 10, 25, 50, 100]],
"iDisplayLength" : -1,
"bProcessing": true,
"bJQueryUI": true,
"bAutoWidth": false,
//"sScrollY": "300px",
"sPaginationType": "full_numbers",
"sAjaxSource": "ReportAction.do?process=home",
"bDeferRender":true,
"sDom": 'T<"clear"><"H"lfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "<%=localrequestedURL %>media/swf/copy_csv_xls_pdf.swf"
}
});
JSON 数据:
result = session.createSQLQuery(sql_homepage).list();
String final_data = gson.toJson(result);
final_message = "{\"aaData\":"+final_data+"}";
1.变量 sql_homepage 指的是对数据库的选择查询。 2.变量final_message被传递给动作类,动作类将数据传递给JSP。
【问题讨论】:
-
您的 JSON 中是否存在语法错误?这可能是一个不错的起点。
-
不,JSON 中没有语法错误
-
在此处发布您的 json 数据或验证您的 json 数据json.parser.online.fr
标签: javascript json jquery-1.5 jquery-1.7