I am writing an Asp.net MVC application and I have an ajax call:
var email = $("#emailInput").val();
alert(email);
$.ajax({
type: "POST",
url: "/Home/Validate",
data:email,
dataType:'text',
success: function (data) {
alert(data);
},
error: function () {
alert("error");
}
});
My controller:
[HttpPost]
public string Validate(string email)
{
}
The parameter email is always null. Any ideas? I've tried sending the email string as a json object, but I've got the same result.