Javascript Json到刀片视图
我尝试将json结果显示到我的blade视图中,但没有显示任何内容。我想知道我哪里做错了,以及为什么表中的结果没有显示 我有一个带有值的表,值随选择框而变化 我在输入url时进行了检查,如下所示:Javascript Json到刀片视图,javascript,arrays,json,laravel,blade,Javascript,Arrays,Json,Laravel,Blade,我尝试将json结果显示到我的blade视图中,但没有显示任何内容。我想知道我哪里做错了,以及为什么表中的结果没有显示 我有一个带有值的表,值随选择框而变化 我在输入url时进行了检查,如下所示: https://mydomaine.eu/go/ready/public/competition/search/equipes?poule_id=2 我得到这个结果: table "<!DOCTYPE html>\n<html l…>\n\n</body>\n
https://mydomaine.eu/go/ready/public/competition/search/equipes?poule_id=2
我得到这个结果:
table "<!DOCTYPE html>\n<html l…>\n\n</body>\n</html>\n"
equipes
0
id 7
equipe_id 14
poule_id 2
lb_equipe "Test"
lb_club_equipe "XIII LIMOUXIN"
nm_club_equipe "111343"
equipe Object
此处显示“我的表格”以显示结果,并使用“选择”框更改结果:
<select id="poule">
@foreach($select_poules as $select_poule)
<option value="{{$select_poule->id}}">{{$select_poule->lb_poule}}</option>
@endforeach
</select>
<table id="equipes" class="table table-striped">
<thead>
<tr>
<th>Club</th>
<th>Nom de l'équipe</th>
<th>Bonus(+/-)</th>
</tr>
</thead>
<tbody>
@foreach($equipes as $equipe)
<tr>
<td>
<a href="{!! route('club.show', $equipe->equipe->structure->id) !!}">{{$equipe->equipe->structure->nom_structure}}</a>
</td>
<td>
<a href="{!! route('equipe.show', $equipe->equipe->id) !!}">{{$equipe->equipe->lb_equipe}}</a>
</td>
<td>{!! Form::text('nb_bonus') !!}</td>
</tr>
@endforeach
</tbody>
</table>
@foreach($select\u poules作为$select\u poule)
{{$select_poule->lb_poule}
@endforeach
俱乐部
诺姆·德·莱奎普
奖金(+/-)
@foreach($equipes作为$equipe)
{!!Form::text('nb_bonus')
@endforeach
下面是我的脚本:
<script>
$('#poule').change(function () {
$.ajax({
type: 'GET',
url : 'search/equipes',
dataType: "json",
data : {
poule_id : document.getElementById('poule').value
},
success: function(data) {
$('#equipes').html(data);
}
});
});
</script>
$('#poule')。更改(函数(){
$.ajax({
键入:“GET”,
url:“搜索/装备”,
数据类型:“json”,
数据:{
poule_id:document.getElementById('poule').value
},
成功:功能(数据){
$('#equipes').html(数据);
}
});
});
如果有人能帮忙,请提前多谢尝试在浏览器中按CTRL+U以查看原始json输出。看起来我的所有网页都在json中,但这正是您想要的,不是吗
response()->json()
将始终将json对象发送回浏览器。我只想将带有foreach循环equipes的表显示为Equipee
<script>
$('#poule').change(function () {
$.ajax({
type: 'GET',
url : 'search/equipes',
dataType: "json",
data : {
poule_id : document.getElementById('poule').value
},
success: function(data) {
$('#equipes').html(data);
}
});
});
</script>