window.onload = function (ev) { init(); } init = function () { getAttributeInfo(); } getAttributeInfo = function () { var parameter = urlEncode(["SelectcountDown"]); $.ajax({ type: "post", url: "/malai/php/index.php", data: {mode: parameter}, dataType: "json", success: function (data) { if (data[0].length == 0 || data == -1) { var th = '暂无数据'; $("#warp").html(th); return; } printAttributeInfo(data); console.log(data); } }); } printAttributeInfo = function (data) { var warp = $("#warp"), tr, href, title = "'查看商品信息'"; warp.html(""); for (var i = 0; i < data.length; i++) { href = "'product-add.html?pid=" + data[i].ProductId + "'"; tr = $('' + '' + data[i].ProductId + '' + '' + data[i].ProductRemarks + '' + '' + data[i].ProductName + '' + '' + data[i].CountDown + '' + '' + '查看H5页面' + '查看产品信息' + ''); warp.append(tr); } $("#loading").css({"display": "none"}); $("#warp").css({"display": "table-row-group"}); } product_add = function (title, url) { var index = layer.open({ type: 2, title: title, content: url }); layer.full(index); } urlEncode = function (arr) { var i; //循环初始化 for (i = 0; i < arr.length; i++) { arr[i] = encodeURIComponent(encodeURIComponent(arr[i])); } return arr.join(); }