You are already using synchronous AJAX (a really bad idea for your user), so this is not a problem. The problem is that you need to undo the default action in the send handler:
$(".submitForm").click(function(e){ var submittable = validatePrices(); e.preventDefault();
Using a synchronous HTTP request to your server for each individual field will make your site terribly slow. You will have to check the parameters on the server again when you submit the form anyway, so it would be much better to just check and return an error.
edit - now that the situation is clearer, I think the way to continue is to completely stop checking the AJAX check. What for? Well, even if you perform these tests, you still need to do almost the same validation tests when the form is actually submitted. You cannot rely on really valid JavaScript validation code, as in any other form validation script. If you still validate while submitting the form, it will save a ton of HTTP requests to just do it all at once.
source share