Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.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 我使用datables.net和laravel的方式返回时会出现什么问题_Php_Laravel_Datatables - Fatal编程技术网

Php 我使用datables.net和laravel的方式返回时会出现什么问题

Php 我使用datables.net和laravel的方式返回时会出现什么问题,php,laravel,datatables,Php,Laravel,Datatables,从我使用datables.net和laravel的方式来看,我回来的时候会有什么问题。提前谢谢你的帮助 $(document).ready(function() { var table = $('#tbl').DataTable({ "processing": true, "serverSide": true, "paginate": true, "ajax": "{{ url('admin/allposts') }}", "deferRender": true, "pa

从我使用datables.net和laravel的方式来看,我回来的时候会有什么问题。提前谢谢你的帮助

$(document).ready(function() {
var table = $('#tbl').DataTable({
  "processing": true,
  "serverSide": true,
  "paginate": true,
  "ajax": "{{ url('admin/allposts') }}",
  "deferRender": true,
  "pagingType": "full_numbers",
  "columnDefs": [ {
        "targets": 0,
        "data": null,
        "mRender": function ( data, type, full ) {
            //this is the part that i want to display what could be wrong
            return  '<div class="thumbnail" style="width: 250px;">
                        <img src="'data[$i+$a]['creatives_url']'" alt="..." width="100px" height="80px">
                        <div class="caption">
                            <h3>Thumbnail label</h3>
                            <p>
                            'data[$i+$a]['program_name']'
                            </p>
                        </div>
                    </div>'

我刚修复了你的返回字符串。尽管您试图在数据[$i+$a]['program_name']中引用$i和$a。如果这些是php变量,则使用{{$i}回送它们。

我在返回时遇到问题,它不会显示上面的html和json代码的那部分,它在一个标记中。这个斜杠是我缺少的一个,我尝试了+concatenation@Lestah那么你想暗示什么呢?如果不想在多行中定义html,请删除\并在一行中编写它们
return '<div class="thumbnail" style="width: 250px;">\
    <img src="' + data[$i + $a]['creatives_url'] + '" alt="..." width="100px" height="80px">\
    <div class="caption">\
    <h3>Thumbnail label</h3>\
    <p>' + data[$i + $a]['program_name'] + '</p>\
    </div>\
    </div>';