收到错误消息;无法加载资源:服务器响应状态为500

问题描述 投票:0回答:1

我正在创建一个应用程序,我注意到,当我尝试在我的工作中包含ajax代码时,它无法运行...而且这个相同的代码正在为视频教程工作,我从它学到了它发生在两个不同的视频教程中我会到达任何与ajax相关的东西......以及它安静令人沮丧的......这是我的代码如下。

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <div class="col-lg-10 col-md-10 col-sm-8 col-xs-6">
                    <div class="row">
                        <h3 class="panel-title">Book List</h3>
                    </div>
                </div>
                <div class="col-lg-2 col-md-2 col-sm-4 col-xs-6">
                    <div class="row" align="right">

                    </div>
                </div>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-sm-12 table-responsive">
<table id="book-table" class="table table-bordered table-striped table-hover">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Book Title</th>
                                    <th>Book Price</th>
                                    <th>Book Author</th>
                                    <th>Rating</th>
                                    <th>Publisher</th>
                                </tr>
                            </thead>
                            <tbody>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<script type="text/javascript">
    $(document).ready(function(){ 
        $('#book-table').DataTable({
            "ajax":{
                url: "<?php echo site_url("books/books_page") ?>",
                type: 'GET'
            },
        });
    });
</script>

当我尝试使用谷歌浏览器开发人员工具检查它时,这是我得到的错误

enter image description here

javascript php ajax xampp codeigniter-3
1个回答
0
投票

从控制台url是错误的,把它如下:

            url: "<?php echo site_url("/books/books_page") ?>",
© www.soinside.com 2019 - 2024. All rights reserved.