ajax异步处理

来源:互联网 发布:淘宝客户端改差评 编辑:程序博客网 时间:2024/05/23 02:01
function doStop(id,parentNodeObj){    if(confirm("确实要停止吗?")){        var str="<div width='100%' align='center'><image src='<%=request.getContextPath()%>/img/loading4.gif'></image></div>";        parentNodeObj.innerHTML=str;        var xhr=createXMLRequest();        if (xhr!=null)        {            xhr.onload=function()            {                window.location="<%=request.getContextPath()%>/testManage_showEnvInstance";            }            xhr.open("post","<%=request.getContextPath()%>/experimentManage_stopExperimentEnv?deploymentId_="+id,true);            xhr.send(null);        }        else        {            document.forms[0].method ='post';            document.forms[0].action="<%=request.getContextPath()%>/experimentManage_stopExperimentEnv?deploymentId_="+id;            document.forms[0].submit();        }    }}