Skip to content Skip to sidebar Skip to footer

Send Data With Jquery To An MVC Controller


Solution 2:

You can do a full post of the form if you like either through ajax $.post or by having an action with [HttpPost] attribute.


Solution 3:

Declare your action as a POST

[HttpPost]
public ActionResult _EditDescription(string docId, string filename, string description)

Create an invisible HTML form:

<form action="@Url.Content("~/OrderDetail/_EditDescription/")" method="post" name="editDescriptionForm">
   <input type="hidden" name="docId" />
   <input type="hidden" name="fileName" />
   <input type="hidden" name="description" />
</form>

Fill out the form and submit it with JS:

function editDescription(docId, fileName, description) {
    document.editDescriptionForm.docId = docId;
    ...

    document.editDescriptionForm.submit();
}

Post a Comment for "Send Data With Jquery To An MVC Controller"