I'm having problems to post json data on ASP.NET MVC 4.
When I call the ajax function I receive the following error: 302 Found.
jQuery Code:
var dataJson = [];
dataJson.push({
name: "Renato Leite"
});
$.ajax({
url: "/Controller/MyAction",
type: 'POST',
dataType: 'json',
data: JSON.stringify(dataJson),
contentType: 'application/json; charset=utf-8',
async : false,
success: function (data) {
var message = data.Message;
}
});
C# Code:
public ActionResult MyAction(string name)
{
return Json(new { Message = "Sucess" }, JsonRequestBehavior.AllowGet);
}
The return of request:
Status Code: 302 Found
How to solve this?
