【发布时间】:2015-02-06 15:50:21
【问题描述】:
让我的数据表运行良好,但是如果我使用默认搜索框,则会出现以下错误。我看不出我在哪里解决这个问题,因为我认为这应该可以解决问题。
我不想配置任何自定义搜索。是我破坏了它还是这是一个错误?
错误
DataTables warning: table id=loadBookings - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
jQuery
$(document).ready(function () {
$('#loadBookings').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "{{ URL::to('api/bookings') }}",
"autoWidth": false,
"aaSorting": [[ 3, "desc" ]],
"aoColumns": [
{ 'sWidth': '40px', "bSearchable": true},
{ "sWidth": "75px", "bSearchable": true},
{ 'sWidth': '80px', "bSearchable": true},
{ 'sWidth': '35px', "bSearchable": true},
{ 'sWidth': '35px', "bSearchable": true},
{ 'sWidth': '55px', "bSearchable": true}
],
"sPaginationType": "full_numbers"
});
});
JSON
{
"sEcho": 0,
"iTotalRecords": 1,
"iTotalDisplayRecords": 1,
"aaData": [
{
"0": "Title",
"1": "Name",
"2": "Joe Smith",
"3": "Accepted",
"4": " 07 Oct 2015",
"5": " <a href="">Update</a>",
"6": "Item 1",
"7": "Accepted",
"DT_RowClass": "accepted"
}
],
"sColumns": [
"bookings.id",
"bookings.title",
{ },
"bookings.location",
"bookings.id",
"bookings.time_id",
"user.name as user_name",
"bookings.start",
"bookings.end",
"bookings.user_id",
"title",
"actions"
]
}
【问题讨论】:
-
请发
URL::to('api/bookings')的样品退货 -
谢谢,已用 JSON 更新
标签: jquery laravel laravel-4 jquery-datatables