I have read almost every question on SO about Ajax Post to controllers. I have tried every single solution that I saw here. Nonetheless, my post still not working. Thus, please do not consider it as a duplicate, at least until I get an answer.
public class BlogController : Controller
{
[HttpPost]
public ActionResult Test(BlogElement data)
{
return null;
}
public class BlogElement
{
public string HtmlContent { get; set; }
public string Date { get; set; }
}
And the Ajax part
var data_ = { HtmlContent: "someContent", Date: "someDate" }
$.ajax({
type: "POST",
url: "/Blog/Test",
dataType: "json",
data:data_
});
Ajax response error says "Not Found". Here is my route config. I am actually only using attribute routing.
routes.MapMvcAttributeRoutes();
What might be wrong with this configuration?