I created a link <a href="#" id="ajaxPost">send model as json</a> which sends this json to my controller:
{
   "textFields":[
      {
         "name":"text",
         "xPath":"/test/text"
      },
      {
         "name":"text2",
         "xPath":"/test/text2"
      }
   ]
}
public PartialViewResult addTextField(List<AddTextFieldModel> textFields) {
    return PartialView("_AddTextField", new AddTextFieldModel("hallo", "123"));
}
via jQuery ajax.
$(document).ready(function () {
        var textFields = [
            { name: "text", xPath: '/test/text' },
            { name: "text2", xPath: '/test/text2' }
        ];      
        
        //textFields = JSON.stringify({ 'textFields': textFields });
       
    $("#ajaxPost").on("click", function (e) {
        e.preventDefault();
        $.ajax({
            contentType: 'application/json; charset=utf-8',
            dataType: 'html',
            type: 'POST',
            url: '@Url.Action("addTextField")',
            data: '{ "textFields":' + JSON.stringify(textFields) + '}',
            success: function (data) {
                $('#mainDiv').html(data);
            },
            failure: function (response) {
                alert(response);
                $('#mainDiv').html(response);
            }
        });
       
    });
 });The problem I have; the .net mvc 4.5.2 does not map the json object to the list of my model:
public class AddTextFieldModel {
    public String Name { get; set; }
    public String XPath { get; set; }
    public AddTextFieldModel(string name, string xPath) {
        Name = name;
        XPath = xPath;
    }
}
Besides how to replace the jQuery ajax call with @Ajax.ActionLink("Add", "addTextField", ???, new AjaxOptions { HttpMethod = "Post", InsertionMode = InsertionMode.Replace, UpdateTargetId = "mainDiv" })
?
 
     
     
    
>(jsonString)`. You will need `Json.NET` for this.
– Rosdi Kasim Jan 22 '16 at 13:21