81,122
社区成员




function showListHtml(isInitPager) {
$.ajax({
url : url,
type : 'post',
data : GLOBL_PARAMOPTION,
cache : false,
success : function(data) {
if (!data.success) {
art.dialog.alert(data.message);
return;
} else {
if (isInitPager) {
initPagination(data.data.total);
}
var html = "";
var list = data.data.list;
if (null != list && list.length > 0) {
for ( var i = 0; i < list.length; i++) {
var seq = ((GLOBL_PARAMOPTION.pageIndex - 1)
* GLOBL_PARAMOPTION.pageSize + (i + 1));
var trClass = "";
if (CONSTANT.striped && i % 2 == 1) {
trClass = " class='bg_lightBlue'";
}
var logDetailStr = "<td> </td>";
if(list[i].isWithDetail == 1){
logDetailStr ="<td><a href='javascript:;' onclick='getLogDetail(\""
+ list[i].logId
+ "\")'><img src='"
+ mainServer
+ "/images/detail.png' height='20' title='详细' alt='详细' border='0'></a></td>";
}
html += "<tr"
+ trClass
+ ">"
+ "<td class='fixed_width_sn right'>"
+ seq
+ "</td>"
+ "<td>"
+ list[i].loginName
+ "</td>"
+ "<td>"
+ list[i].ipAddr
+ "</td>"
+ "<td>"
+ list[i].operTime
+ "</td>"
+ "<td class='left'>"
+ list[i].operDesc
+ "</td>"
+ logDetailStr
+ "</tr>";
}
} else {
html = "<tr><td colspan='8'><font color='red'>" + CONSTANT.listDataEmpty + "</font></td></tr>";
}
$("#tbody").html(html);
}
}
});
}
[/quote]
要是我不使用ajax向后台发送数据,而是从controller中直接返回json,应该怎样写呢?function showListHtml(isInitPager) {
$.ajax({
url : url,
type : 'post',
data : GLOBL_PARAMOPTION,
cache : false,
success : function(data) {
if (!data.success) {
art.dialog.alert(data.message);
return;
} else {
if (isInitPager) {
initPagination(data.data.total);
}
var html = "";
var list = data.data.list;
if (null != list && list.length > 0) {
for ( var i = 0; i < list.length; i++) {
var seq = ((GLOBL_PARAMOPTION.pageIndex - 1)
* GLOBL_PARAMOPTION.pageSize + (i + 1));
var trClass = "";
if (CONSTANT.striped && i % 2 == 1) {
trClass = " class='bg_lightBlue'";
}
var logDetailStr = "<td> </td>";
if(list[i].isWithDetail == 1){
logDetailStr ="<td><a href='javascript:;' onclick='getLogDetail(\""
+ list[i].logId
+ "\")'><img src='"
+ mainServer
+ "/images/detail.png' height='20' title='详细' alt='详细' border='0'></a></td>";
}
html += "<tr"
+ trClass
+ ">"
+ "<td class='fixed_width_sn right'>"
+ seq
+ "</td>"
+ "<td>"
+ list[i].loginName
+ "</td>"
+ "<td>"
+ list[i].ipAddr
+ "</td>"
+ "<td>"
+ list[i].operTime
+ "</td>"
+ "<td class='left'>"
+ list[i].operDesc
+ "</td>"
+ logDetailStr
+ "</tr>";
}
} else {
html = "<tr><td colspan='8'><font color='red'>" + CONSTANT.listDataEmpty + "</font></td></tr>";
}
$("#tbody").html(html);
}
}
});
}
[/quote]
页面我要不拼接呢??该怎么写?function showListHtml(isInitPager) {
$.ajax({
url : url,
type : 'post',
data : GLOBL_PARAMOPTION,
cache : false,
success : function(data) {
if (!data.success) {
art.dialog.alert(data.message);
return;
} else {
if (isInitPager) {
initPagination(data.data.total);
}
var html = "";
var list = data.data.list;
if (null != list && list.length > 0) {
for ( var i = 0; i < list.length; i++) {
var seq = ((GLOBL_PARAMOPTION.pageIndex - 1)
* GLOBL_PARAMOPTION.pageSize + (i + 1));
var trClass = "";
if (CONSTANT.striped && i % 2 == 1) {
trClass = " class='bg_lightBlue'";
}
var logDetailStr = "<td> </td>";
if(list[i].isWithDetail == 1){
logDetailStr ="<td><a href='javascript:;' onclick='getLogDetail(\""
+ list[i].logId
+ "\")'><img src='"
+ mainServer
+ "/images/detail.png' height='20' title='详细' alt='详细' border='0'></a></td>";
}
html += "<tr"
+ trClass
+ ">"
+ "<td class='fixed_width_sn right'>"
+ seq
+ "</td>"
+ "<td>"
+ list[i].loginName
+ "</td>"
+ "<td>"
+ list[i].ipAddr
+ "</td>"
+ "<td>"
+ list[i].operTime
+ "</td>"
+ "<td class='left'>"
+ list[i].operDesc
+ "</td>"
+ logDetailStr
+ "</tr>";
}
} else {
html = "<tr><td colspan='8'><font color='red'>" + CONSTANT.listDataEmpty + "</font></td></tr>";
}
$("#tbody").html(html);
}
}
});
}