zoukankan      html  css  js  c++  java
  • jquery数组内多维对象

    jquery数组内多维对象

     var postData=[],obj,list;
        obj = !!obj ? obj : $('#dist_meici_checkinfo_form');
        obj.find('.dist_meici_product').each(function(i) {
            var ids={},quantity,quantityData,price,priceData,sku_id;
            quantity = $(this).find("[name='quantity[]']").attr('data-value');
            quantityData= $(this).find("[name='quantity[]']").val();
    
            price = $(this).find("[name='price[]']").attr('data-value');
            priceData= $(this).find("[name='price[]']").val();
    
            sku_id =  $(this).find("[name='sku_id[]']").val();
    
            if(quantity !== quantityData){
                ids.quantity = quantityData;
            }
            if(price !== priceData){
                ids.price = priceData;
            }
            console.log(ids);
            if(ids.price || ids.quantity){
                ids.sku_id = sku_id;
                postData.push(ids);
            }else{
                alert('您没有进行修改');
                return true;
            }
            //if($(this).find('i.checkable').hasClass('icon-checked')){  ids.push($(this).attr('data-id')); }
        });
        if(postData && postData.length > 0){
            list  = JSON.stringify(postData);
        }else{
            confirm('您没有进行修改');return;
        }
        console.log(list);
        $.postJ('/dist/meici/editdata',{data:list,dosubmit:1},function(json) {  if(!!json.status) alert(1) });
  • 相关阅读:
    SpringBoot项目设置maven打包时间
    SpringBoot热部署配置
    Git笔记
    SpringBoot LogBack日志配置
    CURL使用教程
    Linux 安装Docker及使用
    转发和重定向的区别
    16周作业
    16
    15周
  • 原文地址:https://www.cnblogs.com/wicub/p/6129283.html
Copyright © 2011-2022 走看看