Hijack MVC3 form submit after model validation

Hijack MVC3 form submit after model validation

Hi,

I'm trying to get some jQuery running in an mvc3 website AFTER the form validates the model but BEFORE the HTTPPOST event handler runs. Is this possible?

Right now I've got both of them (HTTPPOST method and jquery code) running on the click on the submit button with a simple:
 
 $("form").submit(function (e) {} method.

So to sum up, I want it to run in the following order after the submit button is clicked
  • the form the validate the fields with the built in viewmodel validation
  • if the fields are not valid it displays the validationmessages and jquery does not run
  • if the fields are valid jquery runs
  • if the user chooses the proper button the HTTPPOST code moves forward
  • if the user chooses cancel the code stops running and it just goes back to the page

Any help would be appreciated! Thanks!