aQ123
aQ123

Reputation: 590

How to download a file using Ext JS library?

I'm a newby in Ext JS and I need to make a restful call that returns a file to the browser. How should I do this?

This is what I have so far, the call is return but I can't get the file downloaded to the browser.

Ext.onReady(function () {

form = Ext.Ajax.request({
    url: 'http://localhost:8080/getfile',
    success: function(x){
                 return x; 
                 },
    failure: function () { console.log('failure');},
    params: {'someparams': Ext.encode ({'abc': {'hello': '123'}})
            }
    });
});

Upvotes: 2

Views: 10116

Answers (2)

DShost
DShost

Reputation: 483

Sometimes you can use original javascript:

document.location = "/getfile?abc=123";

Upvotes: 1

Sean Adkinson
Sean Adkinson

Reputation: 8605

You might find this thread or this post useful. Basically don't use AJAX here, use a <form> to submit your request

Upvotes: 1

Related Questions