jquery bind onpropertychange

1. JS

$(document).ready(function (){
	$("#zqmj").bind("propertychange",function (){	
		var zqmjVal=$("#zqmj").val();
		var deptment='${appUser.regionid}';
		if(zqmjVal!=null && $.trim(zqmjVal).length>0 && !isNaN(zqmjVal)){
			if($.trim(zqmjVal).length==6){
				$.post("<%=request.getContextPath()%>/wfxx/simple.do?method=searchZqmj",{zqmj:zqmjVal,ssdw:deptment},
					function (data){
						$("#szdw").val(data.ssdwdm);
						$("#szdw1").val(data.dwmc);		
						$("#zqmjdm option[zqmj='"+zqmjVal+"']").attr("selected", true);	
					}, "json"
				);
			}
			else{
				$("#szdw").val("");
				$("#szdw1").val("");
				$("#zqmjdm ").get(0).selectedIndex=0;
			}
		}
	})
});

 

 

2. JAVA

	public ModelAndView searchZqmj(HttpServletRequest request,HttpServletResponse response) throws Exception {	
		response.setCharacterEncoding("GBK");
		response.setContentType("application/json");
		String zqmj=request.getParameter("zqmj");
		String ssdw=request.getParameter("ssdw");	
		ZQMJ zqmjObj=null;
		String xm="";
		String ssdwdm="";
		String dwmc="";		
		
		zqmjObj=this.getZQMJ(zqmj, ssdw);
		if(zqmjObj!=null){
			xm=zqmjObj.getXM();
			ssdwdm=zqmjObj.getSSDWDM();
			dwmc=zqmjObj.getDWMC();
		}
		
		PrintWriter out=response.getWriter();
		String result="{\"xm\":\""+xm+"\",\"ssdwdm\":\""+ssdwdm+"\",\"dwmc\":\""+dwmc+"\"}";
		out.print(result);
		return null;
	}

 

你可能感兴趣的:(jquery bind onpropertychange)