views:

67

answers:

1

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.

A: 

this works:

$("#myForm").validate({
    rules : { ... },
    messages : { ... }
}).form();  
FALCONSEYE