js第一个页面的管理
for (var i = 0; i < jsonResult.data.list.length; i++) {
var resource = jsonResult.data.list[i];
var id = resource.id;
var newCreateDate = new Date(resource.createDate);
Y = newCreateDate.getFullYear() + '-';
M = (newCreateDate.getMonth()+1 < 10 ? '0'+(newCreateDate.getMonth()+1) :newCreateDate.getMonth()+1) + '-';
D = newCreateDate.getDate() + ' ';
h = newCreateDate.getHours() + ':';
m = newCreateDate.getMinutes() + ':';
s = newCreateDate.getSeconds();
var lastTime = Y+M+D+h+m+s;
innerHTML +=
"<tr>" +
//在跳转路径上把参数带上
"<td><a href='/admin/shareComplainDetail.jsp?id=" + id + "' >" + resource.id + "</a> </td>" +
"<td>" + resource.customerId + "</td>" +
"<td>" + resource.customerName + "</td>" +
"<td>" + resource.complaintReasonDes + "</td>" +
"<td>" + resource.merchantId + "</td>" +
"<td>" + resource.merchantName + "</td>"+
"<td>" + resource.complaintStatus + "</td>"+
"<td>" + lastTime + "</td>"
}
第二个页面的详情
//把url传过来的参数取出方法的id
function GetRequest() {
var url = location.search; //获取url中"?"符后的字串
var theRequest = new Object();
if (url.indexOf("?") != -1) {
var str = url.substr(1);
strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = decodeURIComponent(strs[i].split("=")[1]);
}
}
return theRequest;
}
//调用这个方法取出id
var shareComplaintDetailId=GetRequest();
var detailId = shareComplaintDetailId.id;
console.log(detailId);