搜索成功跳转问题

浏览:489 发布日期:2017/07/08 分类:求助交流 关键字: redirect
模仿百度贴吧搜索,输入关键字跳转,点击搜索,谷歌调试模式出现页面,但是只在后端显示,前台不跳转,什么原因呢?想在当前页面跳转到搜索的结果网址。。




controller:

public function searchcheck(){
$sname=$_POST['sname'];
$result=D('section')->getSectionByname($sname);
$id=$result['id'];
if(!$result||$result=NULL){
$this->redirect("Home/Index/index");
}
else{
$this->redirect("Home/Tieba/index?id=$id");
}

}

js:
var search={

check:function() {
var sname=$("#searchname").val();
var url="searchcheck";

$.post(url,{'sname':sname},function(){

},'JSON');
}

}

html:

<input type="button" value="进入贴吧" class="btn2" onclick="search.check()"/>











谢谢了



最佳答案
评论( 相关
后面还有条评论,点击查看>>