Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 未捕获类型错误:无法设置属性';数据';空数据表的定义_Php_Jquery_Ajax_Laravel_Datatables - Fatal编程技术网

Php 未捕获类型错误:无法设置属性';数据';空数据表的定义

Php 未捕获类型错误:无法设置属性';数据';空数据表的定义,php,jquery,ajax,laravel,datatables,Php,Jquery,Ajax,Laravel,Datatables,我想在使用ajax删除数据表后重新加载数据表中的数据。我检查了数据库,该项已被删除,但datatables不会刷新,它会返回此错误 未捕获的TypeError:无法设置null datatables的属性“data” 拉维尔 另外,我从警报中收到了这条消息 DataTables警告:表id=table1-JSON响应无效。更多 有关此错误的信息,请参阅 代码如下: jquery: var tab= jQuery('#table1').DataTable({ "columns": [

我想在使用ajax删除数据表后重新加载数据表中的数据。我检查了数据库,该项已被删除,但datatables不会刷新,它会返回此错误

未捕获的TypeError:无法设置null datatables的属性“data” 拉维尔

另外,我从警报中收到了这条消息

DataTables警告:表id=table1-JSON响应无效。更多 有关此错误的信息,请参阅

代码如下:

jquery:

var tab= jQuery('#table1').DataTable({
    "columns": [
     null,
     null,
     null,
     { "width": "15%" }
   ]
  });

function getPageData() {
        jQuery.ajax({
            url: 'attend/f',
          type: 'GET',
          success: function(data){
             tab.ajax.reload();
        }
      });
    }

    jQuery(".btndelete").click(function(e){
      jQuery.ajaxSetup({
              headers: {
                  'X-CSRF-TOKEN': '{{ csrf_token() }}'
              }
          });
      var id= jQuery(this).data('id');
      e.preventDefault();
      swal({
        title: 'Are you sure?',
        text: "You won't be able to revert this!",
        type: 'warning',
        showCancelButton: true,
        confirmButtonColor: '#3085d6',
        cancelButtonColor: '#d33',
        confirmButtonText: 'Yes, delete it!'
      }).then(function () {

        jQuery.ajax({
          dataType: 'json',
          type: 'delete',
          url: 'attend/' + id + '/delete',
        }).done(function(data){
          getPageData();
        });

      })
    });
路线:

public function attend1($id)
{
  $acara = \App\Model\MyEventList::where('id_user',$id)->get();
  return response()->json();
}

它应该是
returnresponse()->json($acara)应该是
returnresponse()->json($acara)