Skip to content
Advertisement

Unable to download file in laravel ajax on button click

When I am trying to use the download button to download file in laravel ajax, it is not working properly and I am not able to download file.

Below is my code:

JavaScript

Controller:

JavaScript

Ajax:

JavaScript

Advertisement

Answer

Just to pseudo-code it up with trusting your data is coming back as desired I think you need to trigger the download in your success callback with a variation of the following (may need to adjust to your need):

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement