2010-07-05 123 views
2

如何使用Ext JS創建AJAX請求並將響應(PDF文件)加載到新的瀏覽器選項卡(或窗口)中?Ext JS:AJAX響應打開新的瀏覽器選項卡

+2

爲什麼要爲此發出AJAX請求? – ceejayoz 2010-07-05 17:37:56

+0

好問題;在思考一下這個之後,我不應該使用AJAX。如果您將此評論作爲答案,我會接受它。 – Upperstage 2010-07-05 17:47:49

回答

3

我不會爲此使用AJAX請求,因爲您沒有以任何方式更新它們當前所在的頁面。我只是直接鏈接到PDF生成URL。

+0

如果某些東西形成要發佈到url的數據並需要在單獨的窗口中響應,該怎麼辦? – prashu132 2013-06-17 02:53:43

0
// Create an IFRAME. 
var iframe = document.createElement("iframe"); 

// Point the IFRAME to GenerateFile, with the desired attributes as arguments. 
iframe.src = 'something.html'; 

// This makes the IFRAME invisible to the user. 
iframe.style.display = 'none'; 

// Add the IFRAME to the page. This will trigger a request to URL. 
document.body.appendChild(iframe); 
相關問題