Skip to content
Advertisement

Making calculator using Ajax with jQuery validator plugin but Ajax conduct submission before the validation

I’m making calculator using Ajax with validator plugin I could make calculator work but cannot implement validator to this… there are 2 issues.

  1. Since my HTML code’s button type is ‘button’ validation plugin doesn’t work. if I change this to ‘submit’ it redirect to the other page.
  2. Ajax conduct the answer before the validation!

I tried beforeSubmit and submitHandler…..maybe I used it wrong?…
what’s wrong with my JavaScript code?… could anyone help me out please? Many thanks!

JavaScript
JavaScript

Advertisement

Answer

Check that the form is valid by adding a call to jQuery valid() method after validate():

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement