Jquery Form Plugin - $.ajax in beforeSubmit not working properly
Hi,
I have been using the jquery form plugin from Mike Alsup for quite a while and normally don't have any problems, however I am now trying something slightly different. Here is the scenario:
An add user form where in the beforeSubmit I want to go to the server and check if the new user already exists in the database. If some matching users are found the $.ajax returns a json object which I then convert to a list of matching users which appears in a blockUI message window with a button that says "Save Anyway". When this is clicked the beforeSubmit should return true and submit the form.
I have set the $.ajax within the beforeSubmit to be synchronous but it doesn't matter what I try the beforeSubmit always submits the form.
Here is the call to the form plugin: http://pastie.org/1014862
and this is the beforeSubmit function which at the moment is very basic and just returns false: http://pastie.org/1014861
Any help would be really appreciated.
I am also using the validation plugin so I may end up writing a remote validation rule which runs the $.ajax and displays the message.
Cheers,
Dave