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检查,发现页面上也就只有这数组,,其他东西都没有。。
<script> <br /> $('#s_customer').change(function(){ <br /> <br /> $.ajax({ <br /> url:"{:u('crud/billing')}", <br /> type:'post', <br /> data:{ <br /> name:$('#s_customer').val() <br /> }, <br /> datatype:'json', <br /> success:function(data){ <br /> if(data.success) <br /> { $('#phone').html(data.msg) } <br /> <br /> else {alert("失败")} <br /> <br /> <br /> }, <br /> error:function(data){alert(data.status);} <br /> }) <br /> <br /> <br /> }) <br /> <br /> <br /> </script>
怎么样才能实现二级联动呢。。
求大神出答案!!。。
$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 代码
不要随意的去抄人家的代码,要理解为什么要那么写
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号