js window.open隐藏参数提交
1.采用form方式提交
var url = "page/public/exportExcel.jsp";
//create a form
var tempForm = document.createElement("form");
tempForm.id="tempForm1";
//set the way of sending request
tempForm.method="post";
//tempForm.accept-charset="UTF-8";
//the url is used for "window.open"��excute by action of form
tempForm.action=url;
//bind the parameter for "window.open" by attributes "target",such as window attributes
tempForm.target="_blank";
//set the url para by creation of hidden elements
var hideInput = document.createElement("input");
hideInput.type="hidden";
hideInput.name= "title";
hideInput.value= title;
var hideInput2 = document.createElement("input");
hideInput2.type = "hidden";
hideInput2.name = "fields";
hideInput2.value = fields;
var hideInput3 = document.createElement("input");
hideInput3.type = "hidden";
hideInput3.name = "filename";
hideInput3.value = outPutFileName;
var hideInput3_1 = document.createElement("input");
hideInput3_1.type = "hidden";
hideInput3_1.name = "filetype";
hideInput3_1.value = "xls";
var hideInput4 = document.createElement("input");
hideInput4.type = "hidden";
hideInput4.name = "footer";
hideInput4.value = footer;
var hideInput5 = document.createElement("input");
hideInput5.type = "hidden";
hideInput5.name = "headers";
hideInput5.value = JSON.stringify(headers); //if a crossTab,must send the content to server for downloading
if(this.reportTableType=="crossTable")
{
var hideTempInput1 = document.createElement("input");
hideTempInput1.type = "hidden";
hideTempInput1.name = "reportTableType";
hideTempInput1.value = "crossTable";
tempForm.appendChild(hideTempInput1); var hideTempInput2 = document.createElement("input");
hideTempInput2.type = "hidden";
hideTempInput2.name = "contents";
hideTempInput2.value =JSON.stringify(contents) ;
tempForm.appendChild(hideTempInput2);
}
//add the base input-searchCondition
for(var key in searchCondition){
if($.trim(searchCondition[key])!=""){
var hideTempInput = document.createElement("input");
hideTempInput.type = "hidden";
hideTempInput.name = key;
hideTempInput.value = searchCondition[key];
tempForm.appendChild(hideTempInput);
}
}
//add the elements into form
tempForm.appendChild(hideInput);
tempForm.appendChild(hideInput2);
tempForm.appendChild(hideInput3);
tempForm.appendChild(hideInput3_1);
tempForm.appendChild(hideInput4);
tempForm.appendChild(hideInput5); //add the form into the page body
document.body.appendChild(tempForm);
//submit manually
tempForm.submit();
//remove the temp form from the page body
document.body.removeChild(tempForm);
js window.open隐藏参数提交的更多相关文章
- js模拟form表单提交数据, js模拟a标签点击跳转,避开使用window.open引起来的浏览器阻止问题
js模拟form表单提交数据, js模拟a标签点击跳转,避开使用window.open引起来的浏览器阻止问题 js模拟form表单提交数据源码: /** * js模拟form表单提交 * @param ...
- 解决window.location.href参数太长 post提交数据
前言:一提到页面跳转,最常用的一般就是window.location.href,如果需要带参数,也许可以在后面用?拼上,但这样并不安全,而且有个更严重的问题,这样的拼接是有长度限制的,如果达到好几千个 ...
- jsp取addFlashAttribute值深入理解即springMVC发redirect传隐藏参数
结论:两种方式 a.如果没有进行action转发,在页面中el需要${sessionScope['org.springframework.web.servlet.support.SessionFlas ...
- js_html_input中autocomplete="off"在chrom中失效的解决办法 使用JS模拟锚点跳转 js如何获取url参数 C#模拟httpwebrequest请求_向服务器模拟cookie发送 实习期学到的技术(一) LinqPad的变量比较功能 ASP.NET EF 使用LinqPad 快速学习Linq
js_html_input中autocomplete="off"在chrom中失效的解决办法 分享网上的2种办法: 1-可以在不需要默认填写的input框中设置 autocompl ...
- 解决window.location.href参数太长
前言:一提到页面跳转,最常用的一般就是window.location.href,如果需要带参数,也许可以在后面用?拼上,但这样并不安全,而且有个更严重的问题,这样的拼接是有长度限制的,如果达到好几千个 ...
- JS控制DIV隐藏显示
转载自:http://blog.sina.com.cn/s/blog_6c3a67be0100ldbe.html JS控制DIV隐藏显示 一,需求描述: 现在有3个DIV块,3个超链接,需要点击一个链 ...
- 【2017-06-27】Js中获取地址栏参数、Js中字符串截取
一.Js中获取地址栏参数 //从地址栏获取想要的参数 function GetQueryString(name) { var reg = new RegExp("(^|&)" ...
- ajaxFileUpload带参数提交(亲测可用)
使用ajaxFileUpload上传文件时,有时需要带参数提交,网上有很多资料说使用data,但其实要使用data带参数是需要修改的,否则后台是获取不到的. 分析原因: ajaxFileUpload为 ...
- js获取url中参数名也参数值
要撮利用js获取url中参数名也参数值这个不多见了,但我今天需要这样操作,下面我来给大家介绍一下具体的实例方法. 在已知参数名的情况下,获取参数值,使用正则表达式能很容易做到. js的实现方法如下 ...
随机推荐
- 关于JSON 与 对象 、集合 之间的转换
在开发过程中,经常需要和别的系统交换数据,数据交换的格式有XML.JSON等,JSON作为一个轻量级的数据格式比xml效率要高,XML需要很多的标签,这无疑占据了网络流量,JSON在这方面则做的很好, ...
- 【nosql】之ehcache.xml文件属性描述
<ehcache updateCheck="false" name="shiroCache"> <defaultCache <!--最大 ...
- Google 新实现的Protobuf RPC: grpc
转自: http://www.dongliu.net/post/622450 Google 刚刚开源了grpc, 一个基于HTTP2 和 Protobuf 的RPC 实现. Protobuf 本身虽 ...
- Android兼容包之MultiDex
一.MultiDex的产生背景 当Android系统安装一个应用的时候,有一步是对Dex进行优化,这个过程有一个专门的工具来处理,叫DexOpt.DexOpt的执行过程是在第一次加载Dex文件的时候执 ...
- jquery zTree异步搜索的例子--搜叶子节点
参考博客:https://www.cnblogs.com/henuyuxiang/p/6677397.html 前台代码 <%@ page language="java" c ...
- appium的log详细分析
下面介绍appium日志的大概分析 //启动appium服务成功2017-03-24 11:22:49:218 - info: [Appium] Welcome to Appium v1.6.3201 ...
- [转][html]radio 获取选中状态
方法一: if ($("#checkbox-id").get(0).checked) { // do something } 方法二: if($('#checkbox-id').i ...
- word搜狗输入失效切换方法
- ELK 日志查询分析nginx日志
# ======================== Elasticsearch Configuration ========================= # # NOTE: Elasticse ...
- 00012 - ps命令详解
使用权限:所有使用者使用方式:ps [options] [--help]说明:显示瞬间行程 (process) 的动态参数:ps的参数非常多, 在此仅列出几个常用的参数并大略介绍含义-A 列出所 ...