I have a link return from my controller.
public ActionResult ExportGroupSets(parameters){
..............
return(urlLink);
}
In my AJAX, I want to download the returned link and save it in user's PC. How to do that?
BTW, here is an example link return in my controller.
http://localhost/reportrepository/9f43e6fb-6fc1-4527-b6c4-3c26efb80cab.xlsx
I have the following codes in my view page.
$.ajax({
url: '@Url.Action("ExportGroupSets", "Home")',
type: 'POST',
contentType: "application/json",
data: JSON.stringify({ ....Parameters....}),
success: function(url) {
if (url == "Error: Your connection to this website has timed out. Please login again.") {
alert(url);
return;
}
-------------------------------------
codes in saving the file to the users PC.
-------------------------------------
},
error: (function() {
alert("Error to retrieve selected report");
})
});
Thanks
Rj