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 = ['张三','张三','三张三' ...
随机推荐
- autofac Adding services after container has been built
http://stackoverflow.com/questions/6173566/run-time-registration-with-autofac Yes you can, using the ...
- Yii2 使用八 使用scenarios
在model里定义 public function scenarios() { return [ 'add' => ['title', 'content'], ]; } 在rules里定义 [[ ...
- idea的修改文件变颜色
直接用IntelliJ IDEA 拉SVN 工程 时,如下图所示都不勾选可以成功拉取.
- ASP.NET MVC 4+ T.JPager使用
一.同步Link模式 var pagecount = TCalcPager.CalcPageCount(count, pageSize); var page = new TBuilderLinkPag ...
- 是时候放弃Uploadify了
1.Uploadify是什么? Uploadify是来自国外的一款优秀jQuery插件,主要功能是批量上传文件. 这话是复制百度百科的,是:基于jQuery开发的文件上传插件. 2.为什么大家都在用? ...
- hibernate4中使用Session doWork()方法进行jdbc操作(代码)
Hibernate3.3.2版本中getSession().connection()已被弃用,hibernate4中官方推荐使用Session doWork()方法进行jdbc操作 首先看看Work接 ...
- NSOperation GCD 对比 (附NSOperation演练)
项目中使用NSOperation的优点是NSOperation是对线程的高度抽象,在项目中使用它,会使项目的程序结构更好子类化NSOperation的设计思路,是具有面向对象的优点(复用.封装),使得 ...
- 弹出框四 之toastr.js (完成提示框)
1.下载 toastr.js组件 2. $(function () { toastr.success('提交数据成功'); toastr.error('Error'); toastr.warning( ...
- 我也来写:数据库访问类DBHelper(转)
一.前言 相信许多人都百度过:“.net 数据库访问类”.然后就出来一大堆SqlHelper.我也用过这些SqlHelper,也自己写过,一堆静态方法,开始使用起来感觉很不错,它们也确实在很多时候可以 ...
- c++异常总结
堆栈辗转开解(stack-unwinding):如果一个函数中出现异常,在当前函数内即通过 try..catch 捕捉(且捕捉到)的话,可以继续往下执行:如果不捕捉(或未捕捉到)就会抛出(与通过 th ...