Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/467.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
我的Javascript代码没有在laravel中运行_Javascript_Php_Jquery_Laravel 5 - Fatal编程技术网

我的Javascript代码没有在laravel中运行

我的Javascript代码没有在laravel中运行,javascript,php,jquery,laravel-5,Javascript,Php,Jquery,Laravel 5,我在一个Laravel项目上工作,我的Javascript代码没有文字。我已应用警报,但它未显示。当用户单击按钮时,它将显示警报,但不会显示 @extends('layouts.app') @section('content') <div class="container"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="pa

我在一个Laravel项目上工作,我的Javascript代码没有文字。我已应用警报,但它未显示。当用户单击按钮时,它将显示警报,但不会显示

 @extends('layouts.app')

 @section('content')
 <div class="container">
   <div class="row">
    <div class="col-md-8 col-md-offset-2">
        <div class="panel panel-default">
            <div class="panel-heading">Dashboard

            <button id="read-data" class="btn btn-info pull-right btn-xs">Load Data By Ajax</button>
            </div>

            <div class="panel-body">
            <table class="table table-bordered table-striped table-condensed">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>First Name</th>
                        <th>Last Name</th>
                        <th>Full Name</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>

                    </tr>
                </tbody>
            </table>
            </div>
        </div>
    </div>
   </div>
   </div>
       @endsection

       @section('script')

     <script type="text/javascript" charset="utf-8">
      $('#read-data').on('click', function(){

      alert('sdsdsd');

      });
       </script>


    @endsection
@extends('layouts.app'))
@节(“内容”)
仪表板
通过Ajax加载数据
身份证件
名字
姓
全名
行动
@端部
@节(“脚本”)
$(“#读取数据”)。在('click',function()上{
警报(“SDSD”);
});
@端部

警报未显示。

请确保在您的
布局/app.blade.php
中有blade
@yield('scripts')
标记以拾取
@节('script')
blade标记:

 @extends('layouts.app')

 @section('content')
 <div class="container">
   <div class="row">
    <div class="col-md-8 col-md-offset-2">
        <div class="panel panel-default">
            <div class="panel-heading">Dashboard

            <button id="read-data" class="btn btn-info pull-right btn-xs">Load Data By Ajax</button>
            </div>

            <div class="panel-body">
            <table class="table table-bordered table-striped table-condensed">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>First Name</th>
                        <th>Last Name</th>
                        <th>Full Name</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>

                    </tr>
                </tbody>
            </table>
            </div>
        </div>
    </div>
   </div>
   </div>
       @endsection

       @section('script')

     <script type="text/javascript" charset="utf-8">
      $('#read-data').on('click', function(){

      alert('sdsdsd');

      });
       </script>


    @endsection
例如:

<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
    <head>
        ...
    </head>
    <body>
        <div id="app">

            ...

            @yield('content')

        </div>

        @yield('scripts')

    </body>
</html>

...
...
@产量(‘含量’)
@产量('脚本')

确保在您的
布局/app.blade.php
中有blade
@yield('scripts')
标签,以拾取
@部分('script')
刀片标签:

例如:

<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
    <head>
        ...
    </head>
    <body>
        <div id="app">

            ...

            @yield('content')

        </div>

        @yield('scripts')

    </body>
</html>

...
...
@产量(‘含量’)
@产量('脚本')

非常感谢。你解决了我的问题@developernator.你就是mvp!!非常感谢你。你解决了我的问题@developernator.你就是mvp!!检查浏览器控制台中的错误并粘贴到此处,它将清除问题。选择帮助您解决问题的正确答案。非常感谢,我得到了我的答案@非常感谢你,我得到了我的答案@Muhammad Omer Aslam.check error in browser console and paste here它将清除问题选择帮助您解决问题的正确答案非常感谢,我得到了我的答案@非常感谢你,我得到了我的答案@穆罕默德·奥马尔·阿斯拉姆。