首页 > 代码库 > jquery数组内多维对象
jquery数组内多维对象
jquery数组内多维对象
var postData=http://www.mamicode.com/[],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) });
jquery数组内多维对象
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。