Read this documentation page on try to achieve what you want: http://docs.jquery.com/Plugins/Validation/Methods/remote
On Oct 27, 1:08 pm, Ryan <cowdo...@gmail.com> wrote: > I have seriously been fighting this issue for hours. I would > appreciate some advice when someone gets a chance. > > I am wanting to check my database to determine if this user already > exists. I thought I could just add the method to the validation. > Evidently I'm doing something wrong. Here is the code. > > <script type="text/javascript"> > $(document).ready(function(){ > > var checkName = (function(value){ > var dataString = '?mode=checkUser&username=' > + username.val(); > > $.ajax({ > type: "GET", > url: "user_formsubmit.php" + dataString, > success: function(html){ > > if(html == "True") > { > return true; > } > else > { > return false; > } > } > }); > }); > > $.validator.addMethod("checkName", function(value, > element){ > return checkName(value); > }, "This user name already exists."); > > $("#user_form").validate({ > rules: { > > userName: { > required: true, > minlength: 8, > checkName: false > > },