前台
后台
- var xmlHttp;
- function creatXMLHttpRequest() {
- if (window.ActiveXObject) {
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- else if (window.XMLHttpRequest) {
- xmlHttp = new XMLHttpRequest();
- }
- else {
- return;
- }
- }
- function searchName(){
- var name = document.getElementsByName("name")[0].value;
- if(name != ""){
- creatXMLHttpRequest();
- var url = "/kintai/kintai/action/TestAction.do?name=" + name;
- xmlHttp.open("GET",url,true);
- xmlHttp.onreadystatechange = tmpFind;
- xmlHttp.setRequestHeader("If-Modified-Since","0");
- xmlHttp.send();
- }else{
- alert("Is not Null ");
- }
- }
- function tmpFind(){
- if(xmlHttp.readystate == 4){
- if(xmlHttp.status == 200){
- var tmpName = xmlHttp.responseText;
- alert(tmpName == 0?"No have the person":"the person has");
- }
- }
- }
- if(pRequest.getParameter("name") != null){
- String[][] conditionList = new String[1][2];
- conditionList[0][0] = "0";
- conditionList[0][1] = Common.readSqlTrans(pRequest.getParameter("name"));
- qryData = pDbcmd.selQureyPrep(new TestDbcl().getInfoUserAjax(), conditionList);
- String result = "0";
- if(Integer.parseInt(qryData.getRow(0).get("name"))>0){
- result = "1";
- }
- pResponse.setContentType("text/text;charset=UTF-8");
- PrintWriter out = pResponse.getWriter();
- out.write(result);
- out.flush();
- return true ;
- }