1. 程式人生 > >Jquery設置獲取list

Jquery設置獲取list

rec jquery var table tr 獲取 substring query lis func

var listItem = "";
$(‘#AddTable tr‘).each(function () {
if ($.trim($(this).children("td:eq(0)").text()) == "移除") {
var pkid = $.trim($(this).children("td:eq(0)").children("#BusinessCategoryId").val());
var EntireCategoryCode = $.trim($(this).children("td:eq(1)").text());
var BizCategoryName = $.trim($(this).children("td:eq(2)").text());
var RiskLevelId = $.trim($(this).children("td:eq(3)").text());
listItem += ‘{"pkid":"‘ + pkid + ‘","Code":"‘ + EntireCategoryCode + ‘","Name":"‘ + BizCategoryName + ‘","RiskLevelId":"‘ + RiskLevelId + ‘",},‘;
}
});
var lists = { "list": "[" + listItem.substring(0, listItem.length - 1) + "]" };

parent.global = lists

if (global != "") {
var dataObj = eval("(" + global.list + ")"); //轉換為json對象
for (var i = 0; i < dataObj.length; i++) {
alert(dataObj[i].pkid);
}
}

Jquery設置獲取list