post方式下载文件
来源:互联网 发布:vue.js主要是干什么用 编辑:程序博客网 时间:2024/04/29 19:17
post方式下载文件
一般在进行下载文件的时候使用的是get的方式,传入几个参数就行,但是如果是前台把大量的数据传给后台,需要使用post方式。而且经常使用的ajax的方式不能返回文件。
下面是一种解决的方案(需要JQuery):
var DownLoadFile = function (options) { var config = $.extend(true, { method: 'post' }, options); var $iframe = $('<iframe id="down-file-iframe" />'); var $form = $('<form target="down-file-iframe" method="' + config.method + '" />'); $form.attr('action', config.url); for (var key in config.data) { $form.append('<input type="hidden" name="' + key + '" value="' + config.data[key] + '" />'); } $iframe.append($form); $(document.body).append($iframe); $form[0].submit(); $iframe.remove();};
调用的时候这样使用:
var data ={ filename:"testtest", ExcelData:jsonString }; DownLoadFile({url:BASE_URL + 'downloadFile/download',data:data});
0 0
- post方式下载文件
- post方式下载文件
- 以POST方式下载文件
- post方式下载文件ie8不支持
- post方式下载后台传来的文件
- angularjs实现POST方式下载文件,firefox兼容性问题
- React使用Post方式从服务器下载文件
- libevent post下载文件
- Post请求下载文件
- POST方式上传文件
- POST文件上传和下载
- 发送post请求下载文件
- HttpClient使用post方式模拟表单提交数据到服务器并下载服务器文件
- HttpClient使用post方式模拟表单提交数据到服务器并下载服务器文件
- post方式下载文件ie8不支持(二)——中文乱码
- 通过表单form模拟post方式提交多参数实现文件下载
- jersey post方式上传文件
- IOS post方式上传文件
- hbase 映射hive表
- JUC源码分析27-线程池-FutureTask
- ZigBee之帧结构
- malloc、realloc、calloc之间区别
- 5个单例模式写法的解析
- post方式下载文件
- Java——异常处理
- sqlhelper
- 238. Product of Array Except Self
- mybits in
- 解决android中list在ScrollView当中只显示一行的问题
- 定位相关总结
- 异或运算及其应用
- light oj 1283(复杂的动态规划)