You cal call $.ajax specifying you are going to POST data.
As you can see the url property is the controller/action and the data is a collection of fields/property you want to send.
I am using JSON here but you can choose a different way.
url: '<%=Url.Action("DoSomething", "Home")%>',
data: { Name: $('#Field1').val(), MiddleName: $('#Field2').val(), Surname: $('#Field3').val() },
VIEW
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<input type="text" id="Field1" name="Field1" value="" /><br />
<input type="text" id="Field2" name="Field2" value="" /><br />
<input type="text" id="Field3" name="Field3" value="" /><br />
<input type="button" id="post_data" name="post_data" value="Save" />
<script type="text/javascript">
$(document).ready(function() {
$('#post_data').click(function() {
$.ajax({
type: 'POST',
url: '<%=Url.Action("DoSomething", "Home")%>',
data: { Name: $('#Field1').val(), MiddleName: $('#Field2').val(), Surname: $('#Field3').val() },
dataType: 'json',
beforeSend: function(XMLHttpRequest) {
// You can do something before posting data.
},
complete: function(XMLHttpRequest, textStatus) {
var Response = $.parseJSON(XMLHttpRequest.responseText);
if ((XMLHttpRequest.responseText == 'false') || (Response.Status == false)) {
// FAIL
}
else {
// SUCCESS
alert(Response); // Should be true.
}
}
});
});
});
</script>
</asp:Content>
My controller returns a boolean but you can change it with an object.
CONTROLLER:
[HttpPost]
public JsonResult DoSomething(string Name, string MiddleName, string Surname)
{
return (Json(true, JsonRequestBehavior.DenyGet));
}