I am new to using ASP.NET MVC 4 with Web Api.
I want to allow user to download a file, this file I will be creating on the server side. For creating the file I have
You can do something like this inside the view where you want to use jquery. I assume the name of the controller is ExportController. You also have to break down the model variables, or alternatively collect the model inside HttpResponseMessage PostExportData(SomeModel model)
via some other way.
html:
export
javascript:
To use POST
function UpdateForm(modelObject) {
if ($('#hidden-form').length < 1)
{
$('
Then you can just post #hidden-form via js which will trigger the file download
Update: This is a full example for posting, and its not checked for typos etc so debug any minor errors.