大水牛

 

jquery 序列化

 //生成发件人Json信息
        function buildSenderInfoJson() {

            var sendName = $("#SendName").val();
            var sendMobile = $("#SendMobile").val();
            var sendAddress = $("#SendAddress").val();
            var sendMail = $("#SendMail").val();
            var sender = {
                Name: sendName,
                Mobile: sendMobile,
                Mail: sendMail,
                Address: sendAddress
            };
            $("#SenderInfo").val(JSON.stringify(sender));

        }
 //生成货物Json信息
        function buildGoodsInfoJson() {
            var array = new Array();
            $(".tb_goods .tr_data").each(function (i, e) {
                var goodsCNName = $(e).find(".GoodsCNName").val();
                var goodsENName = $(e).find(".GoodsENName").val();
                var goodsCount = $(e).find(".GoodsCount").val();
                var price = $(e).find(".Price").val();
                var currencyType = $(e).find(".CurrencyType").val();
                var buyShopUrl = $(e).find(".BuyShopUrl").val();
                var goodsCustomsNo = $(e).find(".GoodsCustomsNo").val();
                var goods = {
                    GoodsCNName: goodsCNName,
                    GoodsENName: goodsENName,
                    GoodsCount: goodsCount,
                    Price: price,
                    CurrencyType: currencyType,
                    BuyShopUrl: buyShopUrl,
                    GoodsCustomsNo: goodsCustomsNo,
                };
                array.push(goods);
            });

            $("#GoodsModelJosn").val(JSON.stringify(array));
        }

 

posted on 2016-06-27 11:00  liucyi  阅读(208)  评论(0编辑  收藏  举报

导航