2015-07-15 1 views
0

HI Я получаю файл tar в ответ Текст для Ext AJAX мне нужно преобразовать в файл и загрузить. пожалуйста, дайте мне знать в любом случае.Загрузка файла из 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

Вы можете создать скрытую форму, а затем отправить этот код.

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 
     }); 
    } 

 Смежные вопросы

  • Нет связанных вопросов^_^