我正在浏览一些已注册视频的简单搜索,此搜索会返回可通过表单上的帖子搜索到的视频。
问题发生在返回数据时,它不会更新传递给视图的数组页面。
这是我的表格:
import urllib2
request = urllib.open(""http://www.flipkart.com/philips-qt4001-15-trimmer-men/p/itmdu7ymtpdptghq?pid=SHVDU7YMTPDPTGHQ&al=wUEQZ4vph4o9VS1qRXcBE8ldugMWZuE7eGHgUTGjVrrcVamAbZwaUArMgFo2ArKEQzMEtMlIvg8%3D&ref=L%3A6510162326865727417&srno=p_2&query=trimmers+for+men&otracker=from-search")
控制器:
<form action="{{ URL::to("/search-video") }}" method="POST" accept-charset="utf-8" class="formSend BuscarVideoSend" id="form-busca-video">
<div class="col l10">
<input placeholder="Searchvídeo" name="Name" type="text" class="validate input-white Name valid">
</div>
<div class="col l2">
<button type="submit" class="btnSend" > Search</button>
</div>
</form>
要返回的HTML:
public function searchVideo(Request $request){
$data = $request->all();
$videos = TbVideoModel::where(
'nm_video',
'LIKE',
'%'.$data['Name'].'%'
)->get();
return view('layouts.videos', compact('videos', $videos));
}
它在控制台xhr上正确返回数据,但它有这个错误:
<section id="videoMosaic">
<div class="row ">
<ul>
@if(isset($videos))
@foreach($videos as $video)
<li>
<a class="bla-1" href="{{$video->ds_link}}">
<div class="div-imagem-texto">
<img src="http://img.youtube.com/vi/{{$video['ds_imagem_video']}}/0.jpg" alt="">
<div class="texto-sobre-imagem">
<img src="/images/play.png" alt="" class="play">
{{$video->nm_video}}
<p>{{$video->tx_video}}</p>
</div>
</div>
</a>
</li>
@endforeach
@endif
</ul>
</div>
</section>
使用搜索数据更新页面需要什么? TKS
答案 0 :(得分:1)