gpt4 book ai didi

javascript - proengsoft/laravel-jsvalidation 引用错误 : jQuery is not defined

转载 作者:行者123 更新时间:2023-11-30 16:49:46 26 4
gpt4 key购买 nike

我正在使用 proengsoft/laravel-jsvalidation为了验证我的自定义表单请求,但它对我不起作用,它给出了 ReferenceError: jQuery is not defined 。即使在其文档中也搜索了很多有关该问题的信息,但找不到。感谢您的帮助。

//app view
@include('partials.nav')
@include('errors.errors')
@yield('content')

<!-- Scripts -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script>

<!-- Laravel Javascript Validation -->
<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>

要验证我的表单

//Upload Form
{!! Form::model($paper, ['method' => 'POST', 'id' =>'uploadPaper', 'action' => ['PaperController@papershow', $paper->id], 'files' => true]) !!}

@include('partials._paperForm',['submitBtn' => 'Show Paper Details'])

{!! Form::close() !!}

<!-- Laravel Javascript Validation -->
{!! JsValidator::formRequest('App\Http\Requests\PaperRequest'); !!}

我的自定义请求:

//App\Http\Requests\PaperRequest
public function rules()
{
return [ 'title'=> 'required|min:10',
'type' => 'required',
'keywords'=> 'required|min:10',
'abstract'=> 'required|min:50',
'dept_name' => 'required|min:3',
'file' => 'required|mimes:pdf|max:10000',];}

最佳答案

确保在加载依赖它的 validation.js 之前加载 jQuery。

来自文档:

This package also depends of jQuery, but it's not bundled into provided script, you have to include manually

To use this package you muts include jQuery and before the provided public/vendor/jsvalidation/js/jsvalidation.js script

https://github.com/proengsoft/laravel-jsvalidation/wiki/Dependencies

关于javascript - proengsoft/laravel-jsvalidation 引用错误 : jQuery is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30709863/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com