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隐藏参数提交的更多相关文章

  1. js模拟form表单提交数据, js模拟a标签点击跳转,避开使用window.open引起来的浏览器阻止问题

    js模拟form表单提交数据, js模拟a标签点击跳转,避开使用window.open引起来的浏览器阻止问题 js模拟form表单提交数据源码: /** * js模拟form表单提交 * @param ...

  2. 解决window.location.href参数太长 post提交数据

    前言:一提到页面跳转,最常用的一般就是window.location.href,如果需要带参数,也许可以在后面用?拼上,但这样并不安全,而且有个更严重的问题,这样的拼接是有长度限制的,如果达到好几千个 ...

  3. jsp取addFlashAttribute值深入理解即springMVC发redirect传隐藏参数

    结论:两种方式 a.如果没有进行action转发,在页面中el需要${sessionScope['org.springframework.web.servlet.support.SessionFlas ...

  4. 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 ...

  5. 解决window.location.href参数太长

    前言:一提到页面跳转,最常用的一般就是window.location.href,如果需要带参数,也许可以在后面用?拼上,但这样并不安全,而且有个更严重的问题,这样的拼接是有长度限制的,如果达到好几千个 ...

  6. JS控制DIV隐藏显示

    转载自:http://blog.sina.com.cn/s/blog_6c3a67be0100ldbe.html JS控制DIV隐藏显示 一,需求描述: 现在有3个DIV块,3个超链接,需要点击一个链 ...

  7. 【2017-06-27】Js中获取地址栏参数、Js中字符串截取

    一.Js中获取地址栏参数 //从地址栏获取想要的参数 function GetQueryString(name) { var reg = new RegExp("(^|&)" ...

  8. ajaxFileUpload带参数提交(亲测可用)

    使用ajaxFileUpload上传文件时,有时需要带参数提交,网上有很多资料说使用data,但其实要使用data带参数是需要修改的,否则后台是获取不到的. 分析原因: ajaxFileUpload为 ...

  9. js获取url中参数名也参数值

    要撮利用js获取url中参数名也参数值这个不多见了,但我今天需要这样操作,下面我来给大家介绍一下具体的实例方法.   在已知参数名的情况下,获取参数值,使用正则表达式能很容易做到. js的实现方法如下 ...

随机推荐

  1. 【linux】centos6.9设置etc0网卡开机自动获取ip

    在vm新安装的centos系统中,一般选择NAT来设置和主机共享局域网,通过ifconfig etc0 192.168.xx.xx 这种作法机器重启之后就会失效,所以可以使用更改文件的方式完成设置ce ...

  2. VMware中四种网络连接模式的区别

    安装好VMwareWorkstations之后,进行虚拟机网络配置时有四种网络连接方式,桥接.仅主机.NAT.LAN区段. 之所以有不同的模式,在我看来是为了满足不同的网络需求,总的来说:桥接.NAT ...

  3. vue2.0变化

    之前有很多的vue知识总结都是围绕1.0版本实现的,下面主要总结一下2.0相对于1.0的一些变化. 组件定义 在vue1.0中,我们有使用vue.extend()来创建组件构造器继而创建组件实例,如下 ...

  4. [ZZ]面向对象编程,再见!

    面向对象编程,再见!- 机器学习算法与自然语言处理 https://mp.weixin.qq.com/s/icXBlVOOYLvDnER7cEeCeg https://medium.com/@csca ...

  5. is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface | mongodb在windows和Linux导出出错

    执行mongoexport命令的时候 mongoexport --csv -f externalSeqNum,paymentId --host 127.0.0.1:27017 -d liveX -c ...

  6. Unreal Engine 4 Smear Frame效果的实现与分析

    转自:http://www.52vr.com/article-868-1.html 这篇文章介绍了类似守望先锋中的帧转移模糊(Smear Frame)效果.   该效果由Jan Kaluza实现,本博 ...

  7. 递归锁,event事件和信号量

    锁通常被用来实现对共享资源的同步访问.为每一个共享资源创建一个Lock对象,当你需要访问该资源时,调用acquire方法来获取锁对象(如果其它线程已经获得了该锁,则当前线程需等待其被释放),待资源访问 ...

  8. Solr进阶之Solr综合文本相似度的多因素权重排序实现

    现在有个需求是这样子的:需要计算搜索词的权重设置其为总排序权重的0.6,其他因素的权重为0.4其他因素中还有详细的划分.这里我们用Solr如何来实现?众所周知solr默认的排序方式为按照文本相似度来进 ...

  9. Solr查询参数sort(排序)

    摘要: Solr查询每一次返回的数据都有一定的顺序,特定顺序的结果对于业务来说可能非常重要. 不指定排序 一般我们不指定排序规则,这样的结果能满足大部分需求,默认是用文档的得分作为排序标准.相当于加上 ...

  10. Java连接postgreSQL数据库,找不到表。

    postgreSQL数据库遵守SQL标准,表名库名不区分大小写. 数据库中是存在 gongan_address_ALL的表的,但是执行下列代码就会出错. stmt = c.createStatemen ...