表的結構
cId 分類id
cName 分類名稱
gid 父級id
這是我的HTML頁面
{$val.cName}
ajax代碼
thinkphp接收頁面
public function goodsAdd(){
$model=M("category"); $rs=$model->where("pid=0")->select(); $this->assign("rs",$rs); $this->display(); $result = array(); $cate =$_POST['gType']; var_dump($cate); $result = M('category')->where(array('pid'=> $cate))->field('cId,cName')->select(); var_dump($result); $this->ajaxReturn($result,"JSON"); }
請問哪裡出錯了 ajax剛接觸
回複內容:
表的結構
cId 分類id
cName 分類名稱
gid 父級id
這是我的HTML頁面
{$val.cName}
ajax代碼
thinkphp接收頁面
public function goodsAdd(){
$model=M("category"); $rs=$model->where("pid=0")->select(); $this->assign("rs",$rs); $this->display(); $result = array(); $cate =$_POST['gType']; var_dump($cate); $result = M('category')->where(array('pid'=> $cate))->field('cId,cName')->select(); var_dump($result); $this->ajaxReturn($result,"JSON"); }
請問哪裡出錯了 ajax剛接觸
PHP程式碼片段你原來正常的是怎樣的?怎麼又有display又有ajaxReturn的。。