I\'ve been looking at the question here: MVC ajax json post to controller action method but unfortunately it doesn\'t seem to be helping me. Mine is pretty much the exact sa
It's due to you sending one object, and you're expecting two parameters.
Try this and you'll see:
public class UserDetails
{
public string username { get; set; }
public string password { get; set; }
}
public JsonResult Login(UserDetails data)
{
string error = "";
//the rest of your code
}