I can not get to the controller method. I think it may be the url, but I have tried different variations of it. I have been trying to figure this out for way too long.
$.ajax({
url: '@Url.Action("ajaxCall", "ContactForm")',
type: "POST",
cache: false,
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify("test"),
success: function () {
alert("success");
},
error: function () {
alert("fail");
}
})
Here is my controller.
namespace form.Controllers
{
public class ContactFormController : Controller
{
[HttpPost]
public ActionResult ajaxCall(string s)
{
return Content("");
}
}
}
Any idea what is wrong?