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

jquery数组内多维对象的更多相关文章

  1. js jquery 判断元素是否在数组内

    js jquery 判断元素是否在数组内 一,js方法 var arr = ["a", "b", "c"]; // js arr.index ...

  2. php函数:解决数组转对象时数组内中文乱码问题

    function to_urlencode(&$arr){//解决数组转对象时数组内中文乱码问题 foreach($arr as $key => $value){ if(is_array ...

  3. 第三章 JQuery: HelloWorld--常见方法--css--选择器--筛选器--属性--效果--事件--数组操作--字符串操作--对象转换

    1.jQuery简介 为了简化JavaScript 的开发, 一些JavsScript 库诞生了. JavaScript库封装了很多预定义的对象和实用函数.能帮助使用者建立有高难度交互的页面, 并且兼 ...

  4. Array.prototype.removeBeginWithVal(删除数组内以某值开头的字符串对象)

    Array扩展方法: //author: Kenmu //created time: 2015-03-16 //function: 删除数组内以某值开头的字符串对象 Array.prototype.r ...

  5. PHP方便快捷的将二维数组中元素的某一列值抽离出来作为此二维数组内元素的key

    得益于PHP的强大的内置数组函数array_column();array_combine(); 举个小栗子: <?php // 先查询出用户的基本信息 $userArray = [['id' = ...

  6. jquery将具有相同名称的元素的值提取出来放到一个数组内

    jquery将具有相同名称的元素的值提取出来放到一个数组内 var arrInputValues = new Array();  $("input[name='xxx']").ea ...

  7. typescript多维对象数组仿List泛型

    定义对象: namespace entity{ export class MyClass{ public value:number; public rect:string; public constr ...

  8. jquery数组的合并 对象的合并

    直接转自:https://www.cnblogs.com/ooo0/p/7737678.html 1.数组的合并 1.1 concat方法 var a=[1,2,3],b=[4,5,6]; var c ...

  9. ES6数组内对象去重

    这个数组去重转自https://www.cnblogs.com/caideyipi/p/7679681.html, 就当笔记记录: 去重Set const arr = ['张三','张三','三张三' ...

随机推荐

  1. AspnetIdentitySample

    https://github.com/rustd/AspnetIdentitySample http://www.asp.net/web-forms/overview/getting-started/ ...

  2. Lua 之table库

    标准table库 table.concat(table, sep,  start, end) concat是concatenate(连锁, 连接)的缩写,table.concat()函数列出参数中指定 ...

  3. Servlet的配置

    让 Servlet 能响应用户请求,必须将 Servlet 配置在 Web 应用中. Servlet 3.0 中有两中配置方式:        1. 在 Servlet 类中使用 @WebServle ...

  4. yii2中事务不能回滚的解决

    $player1 = Player::findOne(1); $player1->nickname = '111'; $player2 = Player::findOne(2); $player ...

  5. ssh-keygen不是内部或外部命令

    在**/Git/usr/bin目录下找到ssh-keygen.exe,将**/Git/usr/bin路径添加到环境变量中

  6. Ubuntu终端常用的快捷键

    Ubuntu终端常用的快捷键 Ubuntu中的许多操作在终端(Terminal)中十分的快捷,记住一些快捷键的操作更得心应手.在Ubuntu中打开终端的快捷键是Ctrl+Alt+T.其他的一些常用的快 ...

  7. ASP.NET MVC 自己实现登陆验证过滤器

    1.首先添加一个过滤器类,并实现接口中对应的方法 public class YLFAuthorizeAttribute : FilterAttribute, IAuthorizationFilter ...

  8. Xcode常用技巧(2)-使Xcode在创建类时自动添加前缀

    在Xcode5之前的版本中,Xcode在新建项目时,会要求为一个类指定一个前缀,这样方便我们区分相同名字的类.而从Xcode6开始,由于Swift增加了命名空间的关系,Xcode在新建项目时,不会再要 ...

  9. 调整Linux磁盘分区的大小的方法

      昨天数据入库时,一直报错,说磁盘满了,,df -h    一看,发现/目录下只有50G空间,已使用49G:我的程序和dbss都安装在/目录下,ftp到的数据放在/data下的一个子目录下,分解完的 ...

  10. 绕过HR破门而入的求职智慧

    以往我们在网上看到的很多求职文章或指导性纲领,譬如啥自信.做功课.良好形象.华丽的简历.工作经验.口才啥的,其实到了21世纪尤其是互联网高速发展的今天,前面这些技巧就显得无比空洞: 1.因为自信谁都可 ...