开发者社区> 问答> 正文

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));

     }

展开
收起
小旋风柴进 2016-03-25 14:27:31 1762 0
1 条回答
写回答
取消 提交回答
  • $.param({'address':address,'delivity':delivity,'payment':payment}) + '&' + $('#card_form').serialize()

    2019-07-17 19:14:18
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载

相关实验场景

更多