Question: This: 

```
        $.ajax({
            url: '/Merchant/SaveDirty',
            type: 'POST',
            dataType: 'json',
            data: ko.toJSON(dirtyItems),
            contentType: 'application/json; charset=utf-8',
            success: function (data) {
                // get the result and do some magic with it
                //var message = data.Message;
                alert(ko.toJSON(dirtyItems));
            }
        });

```

...currently calls this:

```
[HttpPost]
public void SaveDirty(string json)
{

}

```

...but when I hit the breakpoint in SaveDirty, no data is passed. I've verified that ko.toJSON(dirtyItems) returns a JSON string in the javascript. What am I doing wrong?

Thanks!

Answer: 
you can use the following:

$.ajax({

```
        url: '/Merchant/SaveDirty',

        type: 'POST',

        dataType: 'json',

        data: JSON.stringify(dirtyItems),

        contentType: 'application/json; charset=utf-8',

        success: function (data) {
            ///

```

///

```
        }

    });

```

But if you are using knockout.js in your applicantion then you should do the following:

$.ajax({

```
        url: '/Merchant/SaveDirty',

        type: 'POST',

        dataType: 'json',

        data:JSON.stringify(ko.mapping.toJS(dirtyItems)),

        contentType: 'application/json; charset=utf-8',

        success: function (data) {

            // get the result and do some magic with it

            //var message = data.Message;

            alert(ko.toJSON(dirtyItems));

        }

    });

```
This should works:

```
$.ajax({
            url: '@Url.Action("SaveDirty", "Merchant")'
            type: 'POST',
            dataType: 'json',
            data: JSON.stringify(dirtyItems),
            contentType: 'application/json; charset=utf-8',
            success: function (data) {
                // get the result and do some magic with it
                //var message = data.Message;
                alert(ko.toJSON(dirtyItems));
            }
        });

```