You need to set the content type of the application/json request:
$.ajax({ url: '/image/tag', type: 'POST', contentType: 'application/json; charset=utf-8', data: $.toJSON(tag), success: function (r) { if (r.success == 1) { window.location.href = r.redirect; } } });
Oh, and you donโt need the tag model properties to start with a lowercase letter:
public class Tag { public int TagId { get; set; } public string TagName { get; set; } }
Note 1: The JavaScriptSerializer class, which uses ASP.NET MVC 3 behind the scenes, is able to handle this correctly.
Note 2: In your Tag action, you seem to return the following JSON: {"success":0} , while in your AJAX callback you seem to be using some kind of r.redirect property that does not exist.
Note 3: Avoid naming your controller actions in the same way as your viewing models. Typically, action names should represent verbs (e.g. List , Save , Delete , ...), while view models represent resources ( TagModel , ...).
Darin Dimitrov
source share