开发者

Ext JS: AJAX response opens new browser tab

How can I make an AJAX request using Ext JS and have the re开发者_如何转开发sponse (a PDF file) load into a new browser tab (or window)?


I would not use an AJAX request for this, as you're not updating the page they're currently on in any way. I'd just have a direct, normal link to the PDF generation URL.


// 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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜