getJSON 二级联动

前端之家收集整理的这篇文章主要介绍了getJSON 二级联动前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

后台

	@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> 
原文链接:https://www.f2er.com/json/290716.html

猜你在找的Json相关文章