标签:
1 <script type="text/javascript"> 2 function gongdan_search(elm){ 3 var dangqian_value=$(elm).val(); 4 if(dangqian_value){ 5 $.ajax({ 6 url:‘__URL__/order_infos_list_search‘, 7 type:‘post‘, 8 data:{dangqian_value:dangqian_value}, 9 success:function(data){ 10 if(data!=0){ 11 var d=eval("("+data+")");//js循环处理后台返回的json数组 12 var company=d.company; 13 var cus_name=d.cus_name; 14 var addr=d.addr; 15 var cus_mobi=d.cus_mobi; 16 var wnumber=d.wnumber; 17 if(company){ 18 $(‘.company_view‘).html(company); 19 } 20 if(cus_name){ 21 $(‘.cus_name_view‘).html(cus_name); 22 } 23 if(addr){ 24 $(‘.addr_view‘).html(addr); 25 } 26 if(cus_mobi){ 27 $(‘.cus_mobi_view‘).html(cus_mobi); 28 } 29 if(wnumber){ 30 $(‘.gongdanhao_view‘).val(wnumber); 31 } 32 }else{ 33 $(‘.company_view‘).html(‘暂无数据‘); 34 $(‘.cus_name_view‘).html(‘暂无数据‘); 35 $(‘.addr_view‘).html(‘暂无数据‘); 36 $(‘.cus_mobi_view‘).html(‘暂无数据‘); 37 } 38 } 39 }); 40 } 41 } 42 </script> 43 44 45 46 public function order_infos_list_search(){ 47 $dangqian_value=$this->_post(‘dangqian_value‘); 48 if(!$dangqian_value){ 49 return false; 50 } 51 $where=null; 52 $where[‘wnumber‘]=$dangqian_value; 53 $result=M(‘order_list‘)->where($where)->field(‘wnumber,uid,cus_name,cus_mobi,addr‘)->find(); 54 if(!$result[‘uid‘]){ 55 return false; 56 } 57 $map=null; 58 $map[‘uid‘]=$result[‘uid‘]; 59 $factory_infos=M(‘user_factory‘)->where($map)->field(‘company‘)->find(); 60 if(!$factory_infos){ 61 return false; 62 } 63 $arr=array(); 64 $arr[‘company‘]=$factory_infos[‘company‘]; 65 $arr[‘cus_name‘]=$result[‘cus_name‘]; 66 $arr[‘addr‘]=$result[‘addr‘]; 67 $arr[‘cus_mobi‘]=$result[‘cus_mobi‘]; 68 $arr[‘wnumber‘]=$result[‘wnumber‘]; 69 if(!empty($arr)){ 70 echo json_encode($arr); //返回josn数组 71 }else{ 72 echo 0; 73 } 74 } 75 76 77 78 var content1=$("input[name=‘compliant_jibie‘]:checked").val(); //jquery选中当前radio按钮获取值 79 alert(content1);
标签:
原文地址:http://www.cnblogs.com/719907411hl/p/4503448.html