json function
//保存商品属性
function Attributesnext()
{
//循环获取属性集值和属性文本框值后保存到数据库的Json
var attributesInfo = "[";
var data = $("#hideattributesInfo").val();
data = data.substr(0, data.length - 1);
var arr0 = data.split(‘;‘);
for (var i = 0; i < arr0.length;i++)
{
var arr1 = arr0[i].split(‘:‘);
var AttributeSetsID = arr1[0];
attributesInfo = attributesInfo + "{\"AttributeSetsID\":"+"\""+ $("#tableSkuAttributes").find
("#td"+AttributeSetsID).attr("value")+"\",";
attributesInfo = attributesInfo + "\"AttributeSetsValues\":" + "\"" + $("#tableSkuAttributes").find("#td" +
AttributeSetsID).html() + "\",";
attributesInfo = attributesInfo+ "\"children\":[" ;
var arr2 = arr1[1].split(‘,‘);
for (var j = 0; j < arr2.length;j++)
{
var AttributeID = arr2[j];
attributesInfo = attributesInfo + "{\"AttributeID\":" + "\"" + $("#tableSkuAttributes").find("#txt" +
AttributeID).attr("value1") + "\",";
// attributesInfo = attributesInfo + "\"AttributeValues\":" + "\"" + $("#tableSkuAttributes").find("#txt" +
AttributeSetsID).val() + "\",";
attributesInfo = attributesInfo + "\"AttributeValues\":" + "\"" + $("#tableSkuAttributes").find("#txt" +
AttributeID).val() + "\"},";
}
attributesInfo = attributesInfo.substr(0, attributesInfo.length - 1);
attributesInfo = attributesInfo + "]},"
}
attributesInfo = attributesInfo.substr(0, attributesInfo.length - 1);
attributesInfo = attributesInfo + "]";
$.post("../Handler/AddGoods.ashx?type=SaveAttribut&GoodsCode=" + $("#GoodsCode").val() + "&GoodsVersions=" +
$("#GoodsVersions").val() + "&PackingList=" + $("#PackingList").val(), { Introduction: aa }, function (data) {
var result = $.parseJSON(data);
// alert(data.d);
if (result == "1") {
window.location.href = "GoodsManage.aspx";
} else {
top.Dialog.alert("操作失敗");
}
})
alert(attributesInfo);
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。