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. [LeedCode]279. 完全平方数

    题目描述: 给定正整数 n,找到若干个完全平方数(比如 , , , , ...)使得它们的和等于 n.你需要让组成和的完全平方数的个数最少. 示例 : 输入: n = 输出: 解释: = + + . ...

  2. bzoj5052: 繁忙的财政官

    求区间内相差最小的两个数的差 分sqrt(n)块,预处理两个数在块内,以及一个数在块内一个数在零散部分的情况,询问时归并排序处理两个数都在零散部分的情况,时间复杂度$O((n+q)\sqrt{n})$ ...

  3. redis安装,修改配置文件,多实例部署 redis-server

    redis 安装 解压: [root@Aliyun software]# tar -xvf redis-3.2.11.tar.gz 进入redis根目录: [root@Aliyun software] ...

  4. mysql查询中取差集的问题

    有个场景 现在有个打卡的记录表(daka),记录了用户每天的打卡信息,同时还有个运动打卡表(sport_daka),如果用户有运动打卡则在运动打卡表里面记录. 现在要统计用户的每天的打开信息,包括运动 ...

  5. cnn进行端到端的验证码识别改进

    keras_cnn.py 训练及建模 #!/usr/bin/env python # coding=utf- """ 利用keras cnn进行端到端的验证码识别, 简单 ...

  6. python:数据类型

    一.数据类型 1.数字int型 主要进行计算 bit_length() 当十进制用二进制表示时,最少使用的位数 a = 13 b = a.bit_length() print (b) 2.布尔值boo ...

  7. github----awesome-typescript-projects

    https://github.com/brookshi/awesome-typescript-projects

  8. TensorFlow使用基础-Tensor

    使用 TensorFlow 之前你需要了解关于 TensorFlow 的以下基础知识 :• 使用图 (graphs) 来表示计算 .• 在会话 ( Session ) 中执行图 .• 使用张量 (te ...

  9. delphi正则表达式学习笔记(一)

    在 Delphi 中是没有自带的正则表达式库的,在网上能找到的用于 Delphi 的正则表达式类大体上有两个,分别是 PerlRegEx 和 RegExpr. 前者相当强大,但发布程序时需要带上他的一 ...

  10. HBase的Shell命令和JavaAPI

    HBase的shell操作和JavaAPI的使用: Shell 表操作 创建表 create 'student','info' #表名 列族 插入表 put 'student','1001','inf ...