function getsysinfo() {
......
   xmlhttp.open("post","/page/user/ShowMachine.jsp",true);
   xmlhttp.send(null);  
   alert("注册成功");
...<form action="saveMachineInfo.do" >
....
<input type="submit" name="button" value="注册" onclick="getsysinfo()" />
我想弹出 alert窗口后,返回/ShowMachine.jsp 咋不可以?
返回的是http://localhost:7001/saveMachineInfo.do?usernameo=wwwwww&userunit=wwwwww&username=ceshi&macIp=undefined&ip=undefined&harddiskId=undefined&cpuId=undefined&status=1&button=%E6%B3%A8%E5%86%8C

解决方案 »

  1.   

    window.location = 'http://localhost:7001/saveMachineInfo.do?usernameo=wwwwww&userunit=wwwwww&username=ceshi&macIp=undefined&ip=undefined&harddiskId=undefined&cpuId=undefined&status=1&button=%E6%B3%A8%E5%86%8C';这样?
      

  2.   

     alert("注册成功"); 
     xmlhttp.open("post","/page/user/ShowMachine.jsp",true);
     xmlhttp.send(null);   点注册后,弹出窗口后,再返回到原来的页面??哪里错了
     
      

  3.   


    你这不是ajax吗~·当前页面不会变啊~·
      

  4.   

    你这个不是Ajax吗,又不是打开一个窗口,当然是返回原来的页面
      

  5.   

    window.location.href='/ShowMachine.jsp';//跳转 
      

  6.   

    这是ajax,你要设置回调函数。你这样做肯定不对,你要把你的操作放到回调函数中去完成
      

  7.   

    你这是个ajax提交表单吧?首先要禁掉表单的submit方法,其次要有回调函数,alert("注册成功");和跳转都写到回调函数里面去,此时的ShowMachine.jsp页面是在回调函数里面主动去取,而不是表单提交后服务器返回的。
      

  8.   

    把form里的action="saveMachineInfo.do"去掉
      

  9.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript"> function getsysinfo() {
     createXmlHttpRequest(); //创建XmlHttpRequest对象,楼主可以自己设置,就不写了
     var url="/page/user/ShowMachine.jsp"+"&timestamp="+new Date().getTime();
      xmlhttp.open("GET",url,true);
      
      //设置回调函数
      xmlhttp.onreadystatechange=function(){ 
        if(xmlhttp.readyState==4&&xmlhttp.status==200)
     {
        alert("注册成功");
        window.location.href="/page/user/ShowMachine.jsp";

     }  
      
      }
      xmlhttp.send(null);   
    }
    </script>
    </head><body>
      <form >
    ....
    <input type="submit" name="button" value="注册" onclick="getsysinfo()" />
    </form>
    </body>
    </html>