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 = ['张三','张三','三张三' ...
随机推荐
- webapi输入验证过滤器ValidationActionFilter
public class validationActionFilter:ActionFilterAttribute { public override void OnActionExecuting(S ...
- ElasticSearch之二——集群
ElasticSearch 集群 首先看下ElasticSearch(ES)的架构: 术语解释: cluster:代表一个集群,集群中有多个节点,其中有一个master节点,master通过选举自动产 ...
- 数据库逆向框架代码生成工具:MyBatis Generator的使用
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration ...
- XMLHttpRequestUtil
//XMLHttpRequest类 function XMLHTTPRequestUtil() { this.Instance = null; this.GetXMLHttpRequest = fun ...
- ASP.NET MVC 自己实现登陆验证过滤器
1.首先添加一个过滤器类,并实现接口中对应的方法 public class YLFAuthorizeAttribute : FilterAttribute, IAuthorizationFilter ...
- [整理]Android开发(二)-Weather App
private class WeatherData{ private String _weatherDescription; private Integer _currentTemperature; ...
- PHP输出缓冲(Output Buffering)
什么是缓冲区? 简单而言,缓冲区的作用就是,把输入或者输出的内容先放进内存,而不显示或者读取.至于为什么要有缓冲区,这是一个很广泛的问题~其实缓冲区最本质的作用就是,协调高速CPU和相对缓慢的IO设备 ...
- iOS设置分割线从边框顶端开始
好方法,本来是在xib里面设置自定义分割线位置,结果还是差15像素,该方法亲测好使. IOS8 设置TableView Separatorinset 分割线从边框顶端开始 (转) 在ios8上 [Ta ...
- BSA基础数据维护
平台 BSA基础数据维护 .扇区五个字段的内容 本来值为0,经过107上计算解析,得出正常的数值.然后106上报(200050),得到回复(200051). 查看回复数据,是否有错误.比如提示104 ...
- List对象排序通用方法
import java.util.Collections; import java.util.Comparator; import java.util.List; import java.lang.r ...