2011-11-02 38 views
2

我是一個在Ext JS中的newby,我需要做一個讓瀏覽器返回一個文件的安寧的調用。我應該怎麼做?如何使用Ext JS庫下載文件?

這是我到目前爲止,電話是返回,但我無法將文件下載到瀏覽器。

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

回答

1

您可能會發現this threadthis post有用。基本上,這裏不使用AJAX,使用<form>提交請求

1

有時你可以使用JavaScript的原:

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