Why do you need to call it with AJAX?
You can just do this:
window.location = downloadUrl;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
This is another attempt and trying to download a file using a download link.
I now try to call my controller's download method via jQuery ajax:
$.ajax({
url: downloadUrl,
type: "GET",
}).done(function() {
alert("done");
});
I tried the following two ways to return a download response to the ajax:
return Response::make(Storage::disk('s3')->get($request->path), '200', $headers);
or
return Storage::disk('s3')->download($request->path);
both of them just show up as a text in the response in the browser, but no download is happening
I actually see the data in the response in the Network tab. But how can I trigger a download?
Please or to participate in this conversation.