If I have the following MVC Action:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult GetDocument(int id, string fileName)
{
// ..... //
return File(fileStream, "text/plain", fileName);
}
I want to call the action on a click of a table row using jQuery. But I’m a bit confused, because I don’t think I want an Ajax call here do I?
You don’t want to do this with Ajax, as the response will be provided through the XmlHttpRequest, which is essentially useless at this point. You will need to do a standard post.
What you will likely need to do, is, if you need it to be a post, wrap up a form:
Or change it from a POST to a GET and use a standard hyperlink:
…etc