我得到一个tar文件作为响应文本的Ext AJAX我需要将其转换为文件和下载。请让我知道任何方式。
Ext.Ajax.request({
url : 'download.do',
method:'POST',
async:false,
useDefaultXhrHeader: false,
cors: true,
params : configRequest.parameters,
scope : this,
success : configRequest.success?configRequest.success:function(response){
var res = Ext.decode(response.responseText);
if(res.result && res.result=='error'){
this.ajaxErrorDisplay(res.err);
} }, failure : configRequest.failure?configRequest.failure:function(msg){}});
答案 0 :(得分:0)
您可以创建隐藏表单,然后提交尝试此代码。
getDownloadForm: function(url, requestParams) {
var hiddenForm = Ext.getCmp('download-file-excel-form');
if (!hiddenForm) {
hiddenForm = Ext.create('Ext.form.Panel', {
title:'hiddenForm',
id: 'download-file-excel-form',
height:0,
width: 0,
hidden:true
});
}
hiddenForm.getForm().submit({
url: url,
standardSubmit: true,
method: 'POST',
timeout: 120000,
params: requestParams
});
}