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的实现方法如下 ...
随机推荐
- 【ActiveMQ】之安全机制(一)管控台安全设置
ActiveMQ 管控台基于jetty,默认端口8161,默认用户名,密码都是admin,这样的安全配置过于弱化,所以我们需要修改一下 1.修改端口 找到conf/jetty.xml文件里面这一段配置 ...
- LeetCode——10. Regular Expression Matching
一.题目链接:https://leetcode.com/problems/regular-expression-matching/ 二.题目大意: 实现一个正则表达式,该正则表达式只有两种特殊的字符— ...
- Flex组件参考 代码参考汇总
1:tourdeflex快速熟悉各种组件用法的参考http://www.adobe.com/devnet/flex/tourdeflex.html在线:http://www.adobe.com/dev ...
- Javascript之数组遍历
一.遍历数组的几种方式 1.for...in遍历数组,会遍历数组的索引和数组原型上的对象 2.for循环直接遍历 3.迭代器:forEach(遍历数组中所有的值,并忽略回 ...
- 客户端负载均衡Feign之四:Feign配置
Ribbon配置 在Feign中配置Ribbon非常简单,直接在application.properties中配置即可,如: # 设置连接超时时间 ribbon.ConnectTimeout=500 ...
- [转]VB 读写ini 配置文件
转自 百度知道 C# 读写 ini配置文件 点此链接 'API 声明Public Declare Function GetPrivateProfileString Lib "kernel32 ...
- laraval一键安装包的下载地址
http://laravelacademy.org/resources-download
- IKE协议
IKE协议 一. +IKE(Internet Key Exchange)因特网密钥交换协议 +为IPSec提供了自动协商交换密钥.建立安全联盟的服务 +通过数据交换来计算密钥 IKE(Internet ...
- Socket拆包和解包
对于基于TCP开发的通讯程序,有个很重要的问题需要解决,就是封包和拆包.下面就针对这个问题谈谈我的想法,抛砖引玉.若有不对,不妥之处,恳求大家指正.在此先谢过大家了. 一.为什么基于TCP的通讯程序需 ...
- mysql 删除表 外键出错
MySQL库中有俩表,table1和table2,相互关联,在删除表的时候出错: Cannot delete or update a parent row: a foreign key constra ...