ITeye博客

Ajax应用1

shelllgd · 2010-12-07 16:08 · Web前端 · Markdown

function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

var url = "";
url = "jkhtAjaxAction.do?operFlag=checkSave
xmlHttp = createXMLHttpRequest();
xmlHttp.onreadystatechange = function handleStateChange() {
if (xmlHttp.readyState == 4) {
	if (xmlHttp.status == 200) {
	                           var value = xmlHttp.responseText;
	  			    }
				}
			};
xmlHttp.open("GET", url, true);
xmlHttp.send(null);

response.setContentType("text/html");
response.setHeader("Cathe-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
if ("checkSave".equals(operFlag)) {}
response.getWriter().println(returnflag);

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。