ajax 弹出验证

代码摘要:
//提交url
var url = "<%=request.getContextPath()%>/operation/ksbmgl/checkhmd.jsp?SFZH="+value;

//checkhmd.jsp
<%@ page import="com.xdl.operation.bean.QtdjBean" %>
<%
QtdjBean bean=new QtdjBean();
String sfzh = request.getParameter("SFZH");
String flg=bean.checkHMD(sfzh);
%>
<%=flg %>

//ajax处理
xmlhttp.onreadystatechange = function () {
  if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
     var info=xmlhttp.responseText;
     hmdflg=trim(info);  //去左右空格
 
     //根据hmdflg校验处理
       .....  
      .....
    }
   }
  }

//去左右空格
function trim(msg)
{
    return msg.replace(/(^\s*)|(\s*$)/g, "");
}

通过提交页面中的查询显示解析出与服务器交互的情况.

你可能感兴趣的:(Ajax,jsp,bean)