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的实现方法如下 ...
随机推荐
- 胖子哥的大数据之路(7)- 传统企业切入核心or外围
一.引言 昨天和一个做互联网大数据(零售行业)的朋友交流,关于大数据传统企业实施的切入点产生了争执,主要围绕两个问题进行了深入的探讨: 问题1:对于一个传统企业而言什么是核心业务,什么是外围业务? 问 ...
- STL基础--算法(不修改数据的算法)
不修改数据的算法 count, min and max, compare, linear search, attribute // 算法中Lambda函数很常用: num = count_if(vec ...
- “Hello world! ”
12.1第一篇笔记 Python 方向:1.web全栈 2.人工智能 (java基础) 3. 爬虫开发 4.数据分析(金融) 6个月学习:需完成8-10万行代码的目标 下一步学习方向 ...
- PAT 甲级 1011 World Cup Betting (20)(20 分)
1011 World Cup Betting (20)(20 分)提问 With the 2010 FIFA World Cup running, football fans the world ov ...
- python-selenium 并发执行用例的问题
看了虫师的多进程执行测试用例一直都执行错误,最后解决了 解决方法如下: 使用threading模块 import threading 使用threading.Thread的方法 ,执行用例成功
- c#属性 ——面向对象
String. Format(字符串格式化输出) 相当于Console.WriteLine(字符串格式化输出); 而String.Format是返回一个字符串 属性: 因为把字段全public,会非常 ...
- java 获取两个日期之间的所有天数
Calendar start = Calendar.getInstance(); start.set(2017, 2, 20); Long startTIme = start.getTimeInMil ...
- POJ3635 Full Tank?
[题解] 用dijkstra算法求最短路.同时考虑在每个节点加油(一单位)与否. [代码] #include <iostream> #include <map> #includ ...
- 第9课 基于范围的for循环
1. 基于范围的for循环(range-based for) (1)语法:for(decl : coll){//statement} ①decl用于声明元素及类型,如int elem或auto ele ...
- Unix.Trojan.DDoS_XOR-1木马症状及清理办法
父进程名称: crond 进程名称: bash 进程路径: /usr/bin/bash 进程id: 20,517 命令行参数: /bin/sh /etc/cron.hourly/cron.sh 事件说 ...