jQuery validation plugin and .ajax

Posted by FALCONSEYE on Stack Overflow See other posts from Stack Overflow or by FALCONSEYE
Published on 2010-01-05T22:30:47Z Indexed on 2010/03/22 14:21 UTC
Read the original article Hit count: 617

Filed under:
|
|

So, I have a form where I load divs as I go asking for various user input and displaying some offers.

I have the following:

$("#calcPrice").click(function() { 

 $("#invPricing").validate({
    rules: { ... },
    messages: {... } ,
    submitHandler: function(form) {
     ....
     $.ajax({ 

     });
     $.ajax({ 

     });
     return false; 
   }
  });

My problem is after validation, none of the ajax calls work. If I remove the validation methods (rules, messages, submitHandler), everything works fine. Can somebody tell me what I am missing here? thanks in advance.

btw, these are the ajax calls:

$.ajax({
    dataType: "json",
    type: "get",        
    url: <cfoutput>"#actURL#"</cfoutput>,
    data: formData+"&p_type=LOW&returnJSON=true",        
    cache: false,       
    success: function(result) { 
        // fields to populate:
        $("#rent").val(result.RENT);
        $("#discount").val(result.DISCOUNT);
        $("#salesPrice1").val(result.SALESPRICE);
        $("#cashPrice1").val(result.CASHSALESPRICE);
        $("#tax1").val(result.SALESTAX);               $("#payment1").val(result.PAYMENTS);
            } , 
    error: function(xmlHttpRequest, status, err) {
                confirm('Error!' + err);
            }
    });	

  $.ajax({
     dataType: "json",
         type: "get",        
     url: <cfoutput>"#actURL#"</cfoutput>,
     data: formData+"&p_type=HIGH&returnJSON=true",        
     cache: false,       
     success: function(result) { 
         // fields to populate:
     $("#rent").val(result.RENT);
     $("#discount").val(result.DISCOUNT);
     $("#salesPrice2").val(result.SALESPRICE);
     $("#cashPrice2").val(result.CASHSALESPRICE);
         $("#tax2").val(result.SALESTAX);                            $("#payment2").val(result.PAYMENTS);
            } , 
            error: function(xmlHttpRequest, status, err) {
                confirm('Error!' + err);
            }
    });

I am basically displaying two offers one Low, one High.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about validation