javascript - Initiate File Download via GET request -


so have extjs application in open in combo leads download of file (read: export pdf). using window.open in hit specific url restful in nature , similar to.

window.open('https://example.com/myapp/api/module/someid/exportpdf.pdf?clientid=bizzare123&param1=somevalue'); 

this opens new tab , file download. theoretically request (though doesn't appear in chrome devtools' network tab), , want pass json data request body (data large can't fit in request params).

can done calling same url using ext.ajax.request , passing jsondata? (i believe i'll have handle file coming in response within success callback.

thanks!

p.s. i'm on extjs 4.0

update

earlier had request download file support new feature, had customize download sending post request first, , api sent file directly in response post request.

but rixo mentioned in comments async download of file might not possible directly, had change api such sends file url instead, in post request, , can hit url , initiate file download. , given it's huge enterprise webapp impacting millions of users using ie, wanted avoid using modern apis (which tempting not supported on ie, always).

you want put request body in request? isn't typical application of protocol (though not explicitly disallowed spec), extjs doesn't support out-of-the-box.

you can see in extjs source code (4.0.7) parameters request automatically appended request uri.

if ((method == 'get' || data) && params) {   url = ext.urlappend(url, params);   params = null; } 

this answer has more details, gist "write proxy rewrite request you".


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -