var basePath='<%=basePath%>'; /*ajax请求返回值*/ var response=''; /*创建一个xmlHttp对象*/ var xmlHttp = false; if(window.XMLHttpRequest){ xmlHttp = new XMLHttpRequest(); }else if(window.ActiveXObject){ xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } /*使用XMLHttpRequest对象的函数,这个函数获取服务器的一个文件内容并显示到网页*/ function getData(urlParam,elementId){ if(xmlHttp){ alert(3); var obj=document.getElementById(elementId); alert(4); //通过GET方法请求,将请求封装在URL中 /* xmlHttp.open("GET",urlParam); xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); */ //post请求 xmlHttp.open("POST", urlParam); xmlHttp.onreadystatechange=callBack;//设置服务器响应的处理方法 xmlHttp.send(null);// 发送请求 } } /*回调函数*/ function callBack(){ if(xmlHttp.readyState==4 && xmlHttp.status==200){ response = xmlHttp.responseText; } } /*删除*/ function delPersonInfo(feilds,values,infoId,za0100,rm01id,elementId){ delUrl = "/gwyhr/main/appoint.dd?method=updatePersonInfo&feilds="+feilds+"&values=+"values+"&infoId="+infoId+"za0100="+za0100+"rm01id="+rm01id; getData(delUrl,elementId); var obj = document.getElementById(elementId); if(response != ''){ obj.style.display="none"; } alert(response); response=''; }