Window.location.href以post方式传递参数的方法
2017-08-19 18:13
1111 查看
原文地址:http://colddemon.iteye.com/blog/1608132
想用window.location.href跳转到另外一个界面。但直接传递get方法会暴露数据。
而用ajax或表单提交,有时在执行了方法后,无法跳转到另外的页面。
下面可以实现跳转的效果,却又能够通过post传递方法隐藏数据。
有一个不足就是,在跳转到新页面后,点击“返回”返回的是个空界面,再次点击才能返回到提交界面。
Java代码
<script language=javascript>
document.write("<form action=abc.action method=post name=form1 style='display:none'>");
document.write("<input type=hidden name=name value='"+username+"'/>");
document.write("</form>");
document.form1.submit();
</script>
想用window.location.href跳转到另外一个界面。但直接传递get方法会暴露数据。
而用ajax或表单提交,有时在执行了方法后,无法跳转到另外的页面。
下面可以实现跳转的效果,却又能够通过post传递方法隐藏数据。
有一个不足就是,在跳转到新页面后,点击“返回”返回的是个空界面,再次点击才能返回到提交界面。
Java代码
<script language=javascript>
document.write("<form action=abc.action method=post name=form1 style='display:none'>");
document.write("<input type=hidden name=name value='"+username+"'/>");
document.write("</form>");
document.form1.submit();
</script>
相关文章推荐
- Window.location.href以post方式传递参数的方法
- window.location.href以post方式传递参数
- window.open 以post方式传递参数示例代码
- window.location.href()采用post传递数据
- window.open url 参数post方式传递
- window.location.href 跳转页面时传递参数并且在新页面接收参数
- window.location.href传递汉字参数
- http post 方法传递参数的2种方式
- window.open 以post方式传递参数示例代码
- window.open 以post方式传递参数
- window.open url 参数post方式传递
- html中使用window.location.href()跳转和传递参数。
- window.location.href传递js对象参数及获取参数
- window.location.href()采用post传递数据
- window.location.href 不跳转的解决方法
- JQuery中Ajax的Post提交中文乱码、windows.location.href 中文汉字乱码和springmvc使用原生态HttpServletRequest接收参数中文乱码解决办法
- window.open()实现post传递参数
- ie6下 js 操作 window.location.href 不跳转 的解决方法
- NSMutableURLRequest,在POST方式下传递参数(转)
- $.ajax()post方式请求参数无法传递,request.getParameter()无法获取