I want to get a FileResult
by clicking the button. When I press the button the file is read well, but nothing happens. This is my code,
$(document).ready(function () {
$('#resource_btn').click(function () {
$.ajax({
url: "/Download/DownResource",
type: "POST",
cache: false,
success: function (data) {
// ?
},
error: function () {
alert("error");
}
});
});
});
[HttpPost]
public ActionResult DownResource() {
string fileName = Path.Combine(Server.MapPath("~/images/"), "down_arrow.png");
return File(fileName, "Iamge/png"); // Is that all?
}