开发者

jQuery validation plugin and .ajax

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);
            开发者_Python百科} , 
    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.


this works:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜