public function Billing()
{
//後台ajax驗證
$result = array();
$cate['S_Customer'] =$_POST['S_Customer'];
$result = M('Customer')->where( $cate)->field('phone,c_name')->select();
$this->ajaxReturn($result,"json");
$this->display();
}
為什麼顯示的只是數組,而我原網頁不顯示了,,,難道我的輸出有問題?
只出現[{"phone":"13802149988","c_name":"\u5f20\u4e09"},{"phone":"13802144455","c_name":"\u674e\u56db"}],F12檢查,發現頁面上也就只有這數組,,其他東西都沒有。。
怎麼樣才能實現二級聯動呢。。
回複討論(解決方案)
求大神出答案!!。。
$this->ajaxReturn 裡面有個exit
$this->ajaxReturn 裡面有個exit
嗯,,然後呢,我是初學者,所以還是不明白您的意思,詳細點。。謝了!
thinkphp 的 ajax 響應預設是返回 json 的
再說你也通知 $.ajax 返回的是 json 替我解碼(dataType:'json',)
但是你的返回結果中並沒有 success 和 msg 項
而 $('#phone').html(data.msg) 中,data.msg 的內容應該是 html 代碼
不要隨意的去抄人家的代碼,要理解為什麼要那麼寫
thinkphp 的 ajax 響應預設是返回 json 的
再說你也通知 $.ajax 返回的是 json 替我解碼(dataType:'json',)
但是你的返回結果中並沒有 success 和 msg 項
而 $('#phone').html(data.msg) 中,data.msg 的內容應該是 html 代碼
不要隨意的去抄人家的代碼,要理解為什麼要那麼寫
謝謝指點!