[Django]-How can i save a file response with jQuery?

4👍

In order to get it to download, you’ll need to pass the right headers, and set the actual page location to the new address, as if you were changing page properly.

I don’t think you can initiate a download via an AJAX call. It won’t change page anyway if it starts a download.

Either put the parameters as a GET call, or create a form and submit it.

window.location = '/actions/?action=download&item=' + current;

2👍

You need to navigate to that URL by setting window.location to trigger a normal download.
You cannot trigger a download via AJAX.

👤SLaks

Leave a comment