-
Jquery Download Application Octet Stream카테고리 없음 2020. 2. 22. 08:01
I am little new to JS. I have been searching for the similar answer for a while. I get a response from server like following:Content-Disposition:attachment; filename=Agency1.zipContent-Type: application/octet-streamDate: 2016 May 5 19:41:32+4m 53sServer: Apache-Coyote/1.1Transfer-Encoding: chunkedNow the task is to download this response(a.zip file) on User's local system without user being redirected to an URL or a prompt asking him/her to click a button to download the this zip file. After making an AJAX(POST) request I get a success data. Now I do not know how to proceed.I tried the solution provided by you.
It does not make a call to the URL provided neither does it throw an error. Also, can you tell me how will one handle 'on success' and 'on error' call back from server response when the solution works. Kindly pardon me if I am being naive here. I am little clueless and new to this:).
Jquery Download Zip File Ajax Response
For me one problem is that you are specifying json as the content type and that's why you get plain text of the 'binary' content of the PDF document as result. I cannot figure out why are you making an ajax request to open the PDF file as a simple anchorwould do the trick. So for me you have these options:#1 Just replace your code with a simple anchor:PDF Report#2 Or try changing the contentType to 'application/octet-stream' instead of'application/json; charset=utf-8'.