This is the route for my controller and method:
View Erika Marquez's profile on LinkedIn, the world's largest professional. VP Export & Agency Finance-Private Insurance Placement. 5 years 9 months. Analysis of financial models, due diligence reports as well as financial and legal. Start studying International Econ Chapter 5 Quiz. Learn vocabulary, terms, and more with flashcards, games, and other study tools.
Route::post('exportarDireccionTodos','MyController@exportarDireccionTodos');
I'm calling that route from a click button with javascript:
MyController
have this code:I'm sending some
id
to my model then I'm creating a csv file, but I can't download it, I just see it pretty well made in the developer tools XHR, like this:I've tried with:
And with:
same with:
![Erika Erika](/uploads/1/2/5/0/125076954/724348867.jpg)
Always happens the same, the csv is made but can't download. I've tried 2 other ways to create the csv, but it always is well generated but can't be downloaded
pmirnd
pmirndpmirnd
2 Answers
You're missing the headers in your last call
I'm using these headers on my laravel app to download a file
You may have better luck storing the file temporarily and generating a URL to download from
Brandon KieferBrandon Kiefer
Well, the problem is my logic. I can't download a file with an ajax call.I tried with Laravel-Excel but I had the same problem of coruse.
This thread fix my problem:
and in the ajax:
pmirndpmirnd