How can I make an ajax call without using ActionLink in my controller? Here is a snippet of my controller code:
public IActionResult ExportUsers(List<string> listOfEmails)
{
/*some data processing*/
return File(result, "text/csv", "ExportCandidates.csv");
}
When making the ajax call on the other side, I use the following method:
$.ajax({
url: '/Admin/Testcenter/GenerateInvitationPreview',
type: 'post',
data: {
//some input data to send to the controller
},
success: function (response) {
)
}
});
I have seen examples for PDF files where a base64 file is returned and handled in the ajax response. Is there a way to do something similar for CSV files so that the user can download it?