0

I have an action in controller that returns :

 return this.File(stream.GetBuffer(), "text/plain", "file.csv");

and in my view i got the data using ajax but i dont know how to download the file :

                   $.ajax({       
                    url: '@Url.Action("TelechargerFic")',
                    data: { 
                        id: id,
                        etat: etat 
                    },
                    datatype: "json",
                    type: "POST" ,
                    success: function (data) {
                   
                   // Here 
                   }

any ideas ?

user1187282
  • 1,137
  • 4
  • 14
  • 23
  • [How can I call an MVC FileContentResult by Jquery and get it to prompt the user to save on it's return?](https://stackoverflow.com/a/9821924/8795884) – tontonsevilla Mar 17 '21 at 11:53
  • Also take a look at: https://stackoverflow.com/questions/30704078/how-to-download-a-file-through-ajax-request-in-asp-net-mvc-4 – TheMixy Mar 17 '21 at 14:43

0 Answers0