1

I have

$.ajax({
   url: 'service url',
   type: 'POST',
   async : true,
   contentType: false,
   processData: false,
   cache: false,
   success: function(data){

   },
   error: function(err){}
});

I can see the file in my Content-disposition in the chrome inspector and the response shows an encrypted value in the inspector.

However, no file is being downloaded. What is missing here?

user544079
  • 16,109
  • 42
  • 115
  • 171
  • It looks like you're not passing any data to that url, so why not just link to the file directly? – Fo. Jun 04 '14 at 18:36
  • `false` is not a registered MIME type and, since you don't have any `data` there isn't any content to describe the contentType of. – Quentin Jun 04 '14 at 18:39
  • I am getting the file as a POST . Can you provide some code for resolving this issue? – user544079 Jun 04 '14 at 18:53

1 Answers1

0

Content-Disposition will influence what happens when you load a resource in a browser window.

It doesn't do anything when you are handling the response manually with JavaScript.

If you want to trigger a download from that point, you'd need to handle the response, generate a data: scheme URI and set location to it.

It would be simpler to submit a form to the destination URL in the first place (unless you don't need POST in which case you can just set location to it).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335