在搜索觀,我有這種形式:Codeigniter在同一視圖中顯示搜索結果?
<form class="form-horizontal col-centered" method="POST"action="Search/search">
<div class="form-group">
<div class="col-xs-4 col-centered ">
<input type="text" class="form-control" id="inputPassword3" placeholder="Type something" name="title">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10 col-centered">
<input class="btn btn-default" type="submit" value="Search"name="submit2">
</div>
</div>
</form>
表單動作設置爲:行動= 「搜索/查找」,在CONTROLER
搜索-DC型和SEACH功能。所有做工精細,之後提交表單,我得到的結果,但結果表明在:
http://localhost/ci/index.php/Search/search
我的想法是,以顯示在哪裏形式相同的觀點功能搜索的結果,所以提交表格後,才能得到結果,對搜索視圖。
Tnx
它更好地使用ajax進行搜索,因爲它將響應傳遞給相同的html頁面,並且可以使用返回的響應更新您的html –
我會嘗試一下,tnx – pavlenko
我會使用jqery ajax而不是純ajax。把事情簡單化。 –