function showloading1(){ 
document.regform.submit();
window.location.href=""
}我想让js在向后台提交的同时 跳转到另外一个页面
上面的代码 在本地可以实现但是上传到服务器的时间  有时先跳转
有时先提交请问大家一般是怎么实现类似跳转的  除了ajax外 有什么比较稳定的方法

解决方案 »

  1.   

    function showloading1(){ 
    document.regform.submit();
    window.open("x.html")
    }
      

  2.   

    window.location="xx.html"这样就可以了
      

  3.   

    如果是“请稍等”这样的功能,建议用Ajax来异步提交
      

  4.   

    你可以放额外的一个 Form 用于提交, 或者放一 iframe 替Form 提交
      

  5.   

    放在java中:
    response.setContentType("text/html;charset=GB2312");
      PrintWriter out=response.getWriter();
      out.println("<HTML> <BODY>");
      out.println("<script language='javascript'>");
      out.println("alert('提交完成!');");//可以不写
      out.println("parent.biao.location.replace('Order/Pro_SHbuy_OrderAddList.jsp')");//填写你要跳回的页面
      out.println("</script>");
      out.println("</body> </html>"); 
      

  6.   

    xxx.submit()后让服务器返回HTML来强制跳转页面
      

  7.   

    jquery  ajax方法,写得有点罗索了,呵呵,但我的态度真诚,哈哈$.ajax({type:'POST',
       beforeSend:function(){
       //未提前执行的语句
       },
       url:'abc/def.aspx',//提交地址
       data:'id=1&name='+$("#abc").val(),
       dataType:'html',
       success:function(msg){
       //msg为提交后返回数据,自己可定义,可判断是否成功,返回类型自已看,一般返回ture或false,当然你可以选择返回1,0或其他信息
       //比如返回的是0,1,2,3四种情况
       //0表示失败
       //1表示成功,并跳到a.html
       //2表示成功,并跳到B.html
       //2表示成功,并跳到c.html
       if(msg==0)
       {
     $("#info").html("提交失败!");  
     }
     else if(msg==1)
     {
     window.location.href="a.html";
      }
      else if(msg==2)
      {
      window.location.href="b.html";
    }
      else if(msg==3)
      {
      window.location.href="c.html";
    }
       }
       });