0 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="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
Run Code Online (Sandbox Code Playgroud)
警报未显示。
确保layouts/app.blade.php您有刀片@yield('scripts')标签来拿起@section('script')刀片标签:
例子:
<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
<head>
...
</head>
<body>
<div id="app">
...
@yield('content')
</div>
@yield('scripts')
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2676 次 |
| 最近记录: |