Javascript 尝试在laravel中使用select标记not request form action to modal执行jquery传递值
我在Javascript 尝试在laravel中使用select标记not request form action to modal执行jquery传递值,javascript,php,jquery,laravel,Javascript,Php,Jquery,Laravel,我在laravel方面是新手,尝试使用表单操作将值传递给模态表单,只需选择标记。我的问题是如何将Jquery值存储到这个phplaravel变量这里是我的代码 page1.blade.php <select id="selectUser" name="selectUser" class="form-control text-md-right"> <option value="" disabled selected>Please Select Service</op
laravel
方面是新手,尝试使用表单操作将值传递给模态表单,只需选择标记。我的问题是如何将Jquery值存储到这个phplaravel
变量这里是我的代码
page1.blade.php
<select id="selectUser" name="selectUser" class="form-control text-md-right">
<option value="" disabled selected>Please Select Service</option>
@foreach($ListServices as $lst)
<option value="{{$lst->ServiceName}}">{{ $lst->ServiceName }}</option>
@endforeach
</select>
<br /><br />
<a href="" class="btn btn-danger" data-toggle="modal" data-target="#searchprofile">
SEARCH
</a>
@include('searchview-modal')
<script type="text/javascript">
$(document).ready(function() {
$('#selectUser').on('change', function() {
var search = this.value; <-- this how?
{{ $lst->ServiceName = "this.value" }}
});
});
<!-- MODAL FORM -->
<div class="modal fade" id="searchprofileservices" tabindex="-1" role="dialog" aria-labelledby="searchprofileservicesLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@if(isset($lst->ServiceName))
<h5 class="modal-title" id="searchprofileservicesLabel">SEARCH RESULT {{ $lst->ServiceName }}</h5>
@else
<h5 class="modal-title" id="searchprofileservicesLabel">SEARCH RESULT </h5>
@endif
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="table">
<thead class="thead-light">
<tr>
<th>IMAGE</th>
<th>NAME</th>
<th>RATE</th>
<th>##</th>
</tr>
</thead>
<tbody>
@foreach($ProfileList as $Profile)
@if($Profile->name == $lst->ServiceName)
// add to column...
@endif
@endforeach
</tbody>
</table>
</div> <!-- End of modal-body -->
</div> <!-- End of modal-content -->
</div>
</div>
请选择服务
@foreach($lst形式的ListServices)
{{$lst->ServiceName}
@endforeach
@包括('searchview-modal')
$(文档).ready(函数(){
$('#selectUser')。在('change',function()上{
var search=this.value;ServiceName=“this.value”}
});
});
我的模式表单,其中包括搜索视图Modal.blade.php
<select id="selectUser" name="selectUser" class="form-control text-md-right">
<option value="" disabled selected>Please Select Service</option>
@foreach($ListServices as $lst)
<option value="{{$lst->ServiceName}}">{{ $lst->ServiceName }}</option>
@endforeach
</select>
<br /><br />
<a href="" class="btn btn-danger" data-toggle="modal" data-target="#searchprofile">
SEARCH
</a>
@include('searchview-modal')
<script type="text/javascript">
$(document).ready(function() {
$('#selectUser').on('change', function() {
var search = this.value; <-- this how?
{{ $lst->ServiceName = "this.value" }}
});
});
<!-- MODAL FORM -->
<div class="modal fade" id="searchprofileservices" tabindex="-1" role="dialog" aria-labelledby="searchprofileservicesLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@if(isset($lst->ServiceName))
<h5 class="modal-title" id="searchprofileservicesLabel">SEARCH RESULT {{ $lst->ServiceName }}</h5>
@else
<h5 class="modal-title" id="searchprofileservicesLabel">SEARCH RESULT </h5>
@endif
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table class="table">
<thead class="thead-light">
<tr>
<th>IMAGE</th>
<th>NAME</th>
<th>RATE</th>
<th>##</th>
</tr>
</thead>
<tbody>
@foreach($ProfileList as $Profile)
@if($Profile->name == $lst->ServiceName)
// add to column...
@endif
@endforeach
</tbody>
</table>
</div> <!-- End of modal-body -->
</div> <!-- End of modal-content -->
</div>
</div>
@if(isset($lst->ServiceName))
搜索结果{{$lst->ServiceName}
@否则
搜索结果
@恩迪夫
&时代;
形象
名称
比率
##
@foreach($ProfileList作为$Profile)
@如果($Profile->name==$lst->ServiceName)
//添加到列。。。
@恩迪夫
@endforeach
问题
如果在laravel中有其他实现方法,请务必让我知道,我可能会学习一些关于框架的知识,就像我说的,我对它很熟悉,并尝试探索它的功能。这是错误的尝试方式。请按以下步骤做
- 首先,您必须与所选用户一起向控制器发出请求
- 然后执行查询并根据所选用户检索集合
- 然后在模态体上循环。 您可以通过jqueryajax方法来实现