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) });
jquery数组内多维对象的更多相关文章
- js jquery 判断元素是否在数组内
js jquery 判断元素是否在数组内 一,js方法 var arr = ["a", "b", "c"]; // js arr.index ...
- php函数:解决数组转对象时数组内中文乱码问题
function to_urlencode(&$arr){//解决数组转对象时数组内中文乱码问题 foreach($arr as $key => $value){ if(is_array ...
- 第三章 JQuery: HelloWorld--常见方法--css--选择器--筛选器--属性--效果--事件--数组操作--字符串操作--对象转换
1.jQuery简介 为了简化JavaScript 的开发, 一些JavsScript 库诞生了. JavaScript库封装了很多预定义的对象和实用函数.能帮助使用者建立有高难度交互的页面, 并且兼 ...
- Array.prototype.removeBeginWithVal(删除数组内以某值开头的字符串对象)
Array扩展方法: //author: Kenmu //created time: 2015-03-16 //function: 删除数组内以某值开头的字符串对象 Array.prototype.r ...
- PHP方便快捷的将二维数组中元素的某一列值抽离出来作为此二维数组内元素的key
得益于PHP的强大的内置数组函数array_column();array_combine(); 举个小栗子: <?php // 先查询出用户的基本信息 $userArray = [['id' = ...
- jquery将具有相同名称的元素的值提取出来放到一个数组内
jquery将具有相同名称的元素的值提取出来放到一个数组内 var arrInputValues = new Array(); $("input[name='xxx']").ea ...
- typescript多维对象数组仿List泛型
定义对象: namespace entity{ export class MyClass{ public value:number; public rect:string; public constr ...
- jquery数组的合并 对象的合并
直接转自:https://www.cnblogs.com/ooo0/p/7737678.html 1.数组的合并 1.1 concat方法 var a=[1,2,3],b=[4,5,6]; var c ...
- ES6数组内对象去重
这个数组去重转自https://www.cnblogs.com/caideyipi/p/7679681.html, 就当笔记记录: 去重Set const arr = ['张三','张三','三张三' ...
随机推荐
- NetBeans使用习惯:升级与保存配置
如何升级:点击 netbeans 的升级更新 ,即可升级版本:不推荐官网下载进行安装,否则会出现,以前的旧版本8.0的目录和8.0.1目录,虽然它会自动检测到以前版本的配置,提示导入... 如何备份: ...
- [译]git push
push就是把你本地仓储的commit传到远程仓储中去. 用法 git push <remote> <branch> push指定的分支到<remote>中去. ...
- uva10870 递推关系Recurrences
Consider recurrent functions of the following form:f(n) = a1f(n - 1) + a2f(n - 2) + a3f(n - 3) + : : ...
- R语言练习(一)
b = seq(from=0, to=1, by=0.001) #一次方 l1 = function(b){ b^1 } y1 = l1(b) #二次方 l2 = function(b){ b^2 } ...
- POJ 2029 Get Many Persimmon Trees
Get Many Persimmon Trees Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3243 Accepted: 2 ...
- 如何编译Apache Hadoop2.6.0源代码
如何编译Apache Hadoop2.6.0源代码 1.安装CentOS 我使用的是CentOS6.5,下载地址是http://mirror.neu.edu.cn/centos/6.5/isos/x8 ...
- PHP array_multisort() 函数详解 及 二维数组排序(模拟数据表记录按字段排序)
一.先看最简单的情况. 有两个数组: $arr1 = array(1, 9, 5); $arr2 = array(6, 2, 4); array_multisort($arr1, $arr2); pr ...
- 非阻塞SOCKET套接字connect等待时间的实现
SOCKET cClient; cClient=socket(AF_INET,SOCK_STREAM,0); //设置为非阻塞套接字 int iMode = 1; i ...
- C 文件读写 容易疏忽的一个问题
今天需要解决一个问题,将影像瓦片(一堆jpg文件)分别进行读取,并将所有数据以文件流的方式存入一个.db的文件中, 同时将每个jpg数据在db文件中的位置保存下来,作为index存在.idx文件中. ...
- EF接触03
emdx文件解读: