Extjs, handling success or failure when doing a st

2019-07-22 01:27发布

问题:

I'm downloading a file from a servlet with a form submit in Ext, but when I try to handle the success or failure of my submit it just never get fired and my waitMsg goes on forever.

Any help would be appreciated.

    var form = Ext.create('Ext.form.Panel',{

        standardSubmit: true,

        url: '../ObtenerArchivoAdjuntoServlet',


    });    

form.submit({

            waitMsg: 'Descargando...',

        params:{

            nombreArchivo:nombreArchivo

        },

        success: function(form, action){ //not getting fired

            //do something

        },

        failure: function(form, action){ // not getting fired

            //do something


        }

    });

回答1:

You can't handle success or failure, because once you submit it, it works like a normal old HTML form post, the browser changes the URL to a new page, so you can never know the result.