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> 

相关文章

AJAX是一种基于JavaScript和XML的技术,能够使网页实现异步交...
在网页开发中,我们常常需要通过Ajax从后端获取数据并在页面...
在前端开发中,经常需要循环JSON对象数组进行数据操作。使用...
AJAX(Asynchronous JavaScript and XML)是一种用于创建 We...
AJAX技术被广泛应用于现代Web开发,它可以在无需重新加载页面...
Ajax是一种通过JavaScript和HTTP请求交互的技术,可以实现无...