I wanted this function to call my MVC action method, which returns a CSV report.
$(function() {
$('#exportButton').click(function() {
$.get('/curReport/GetCSVReport');
});
});
If I make a button similar to the code below, then when it is pressed, the "Open with / Save file" window will open.
<input type="button" value="Export" onClick="location.href='CurReport/GetCSVReport'">
However, when I change my button to use my jQuery function, although it GetCSVReport()is being called, they do not give me the "Open with / Save file" window.
Here is my GetCSVReport()
public FileResult GetCSVReport()
{
...
return fileResult;
}
How can I make my jQuery function work like onClick?
Thank,
Aaron
source
share