后台:
@RequestMapping(value = "/coco/get_person_info.do") @ResponseBody public ResponSEObject get_person_info(HttpServletRequest req,HttpServletResponse res,String id) { ResponSEObject ro = new ResponSEObject(); CocoPersonInfo cocoPersonInfo=null; if (id!=null && !id.equalsIgnoreCase("")){ cocoPersonInfo=this.cocoService.getCocoPersonInfo(id); } ro.setStatus(ResponSEObject.STATUS_SUCCESS); ro.setMessage("人员基本信息"); ro.setModel(cocoPersonInfo); return ro; }
html:
<select style= "width:125px"id="cocoPersonInfoId" name="cocoPersonInfoId" onchange="getPersonInfo(this.value);" > <option value="" >请选择</option> <option value="1" >1</option> </select> <script type="text/javascript"> function getPersonInfo(value) { var date = new Date(); if(value!=""){ $.getJSON( '../coco/get_person_info.do?date='+date,{'id':value},function(data){ $("#code").val(data.model.code); } ); }else $("#code").val(""); } </script>