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 = ['张三','张三','三张三' ...
随机推荐
- HTML5播放器实例
鉴于html5Audio and video的使用,设计了一个自定义风格的播放器,除实现一些基本的默认功能之外,还实现了一些高级功能. 具体功能如下: 实现播放暂停按钮 实现静音按钮 实现音量调节滑动 ...
- Create new tool for CSV
CsvFileStream.cs public class CsvFileStream { TextReader stream; bool EOS = false; bool EOL = false; ...
- linq 多表分组查询统计
var q1 = from orderitem in q2 join pd in _iProductDetailContract.Entities on orderitem.ProductDetail ...
- PHP数组处理函数的使用array_push(一)
使用PHP做数据处理时会涉及到大量的数组操作,这里我就记下各种数组处理函数的使用方法,好记性不如烂笔头!! 一.array_push的使用方法:将一个或多个单元压入数组的末尾(入栈) 说明:int a ...
- ps切图设置
1. 新建设置 文件->新建->预设->自定义 1920 像素 2000 像素 72 像素/英寸 背景内容 透明 存储预设 2.视图设置 视图->显示->智能参考线选中视 ...
- Orchard源码分析(6):Shell相关
概述在Orchard中,提出子站点(Tenant)的概念,目的是为了增加站点密度,即一个应用程序域可以有多个子站点. Shell是子站点(Tenant)级的单例,换句话说Shell代表了子站点.对比来 ...
- Ajax 局部刷新
方式一:function hits1(troops) { var troops = troops; var ajax=Ajax(); var url = 'xxx.php'; ...
- InnerClass内部类
1,内部类概述 定义:把A类定义在B类内部,则A类是内部类.如下所示: class Outer1{外部类 String name1; public void show(){ System.out.pr ...
- 【Junit】The import org.junit.Test conflicts with a type defined in the same file报错
引入Junit后,进行单元测试,莫名其妙报了个这样的错误 The import org.junit.Test conflicts with a type defined in the same fil ...
- 基于iSCSI的SQL Server 2012群集测试(五)--镜像,作业,复制分发测试
7.1.镜像测试 群集可以正常镜像到非群集环境,本次测试采用,无见证服务器的sql server验证的镜像连接,不同的是群集环境的镜像IP是采用SQL Server虚拟IP进行通信连接. 群集服务器: ...