I have a form with validation:
<form role="form" method="POST" action="" >
<input type="password" class="form-control top-buffer-sm" placeholder="Password" name="password" required autofocus></input>
<input type="email" class="form-control top-buffer-sm" placeholder="Email" name="email" required autofocus></input>
<div class="modal-footer">
<button id="createUser" type="submit" class="btn btn-primary">Create</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
My submit button has an id and i need to do some other functionality before i submit the form:
$('#createUser').click(function(){
//check to see if validation passed
//do custom stuff
//now make ajax call
$.ajax();
});
but if the form is not valid, my ajax call is still being made, of course resulting in a server error. How do i check to see if the form passed the validation when i click the submit button? Thanks