I am new to jQuery and asp.net mvc. My problem is that I call a method in the controller that returns a FileStreamResult. This works fine, but when I call it with a jQuery column, it doesn't work. I can see with the debugging tool vs that the program is superseding the method. So I think this has something to do with the fact that my jQuery call should take care of the returned parameter? Somenoe?
JQuery Code:
<script type="text/javascript">
function createPPT() {
$.post("<%= Url.Action( "DownloadAsPowerpoint", "RightMenu" )%>");
}
</script>
Method in the controller:
public ActionResult DownloadAsPowerpoint()
{
Stream stream;
HttpContext.Response.AddHeader("content-disposition", "attachment; filename=presentation.pptx");
return new FileStreamResult(stream, "application/pptx");
}
Can someone explain and give me some sample code?
source
share