Extjs 4 downloading a file through ajax call

前端 未结 7 1258
陌清茗
陌清茗 2021-01-06 16:16

The problem is very simple: i have to download a file when i submit a form, it\'s an ajax call when the form is submitted which lets me build a file with the data taken from

7条回答
  •  星月不相逢
    2021-01-06 17:09

    I had a similar problem trying to download an Excel File in an Ajax call I solved it this way:

    Make a standard sumbit instead of Ajax.

    var form = Ext.create('Ext.form.Panel', { // this wolud be your form 
        standardSubmit: true,         // this is the important part 
        url: '../ObtenerArchivoAdjuntoServlet' 
    });
    
    form.submit({
        params: {
           nombreArchivo: nombreArchivo
        }
    });
    

    After this you would be able return the desired file.

提交回复
热议问题