首页 > 代码库 > ajax 多个表单值问题,表单序列化加其它表单值

ajax 多个表单值问题,表单序列化加其它表单值

$.ajax({
    type: "post",
     url: "{:u(‘cart/totalByCard‘)}?t="+Math.random(9999), 
     data: {‘address‘:address,‘delivity‘:delivity,‘payment‘:payment,$(‘#card_form‘).serialize()},
     dataType: "json",
     success: function(json)
     {
        $(‘#cost_item‘).html(‘¥‘+parseFloat(json.cost_item).toFixed(2));
        $(‘#cost_freight‘).html(‘¥‘+parseFloat(json.cost_freight).toFixed(2));
        $(‘#total_amount‘).html(‘¥‘+parseFloat(json.total_amount).toFixed(2));
        $(‘#pmt_order‘).html(‘¥‘+parseFloat(json.pmt_order).toFixed(2));

     }
$.param({‘address‘:address,‘delivity‘:delivity,‘payment‘:payment}) + ‘&‘ + $(‘#card_form‘).serialize()
//$.param序列化key/value 对象

 

ajax 多个表单值问题,表单序列化加其它表单值