I am creating an MVC 3 web application. I want to use Data Annotations on my entity class and then use unobtrusive client side validation before making a post back to the se
Paul's solution is the correct answer to the question, not Dr Rob's.
Although you can just use valid() instead of validate().form().
But more importantly, there really is no reason to restrict your code as suggested by Dr Rob, ie, not .click and only use .submit. That isn't what solved the problem! What solved the problem was wrapping the $.ajax(...) call in the if statement. Ie:
if($("#MyForm").valid())
{
//call to $.ajax or equivalent goes in here.
}
I think that needs clarifying as otherwise the real answer to the problem is obfuscated.