jquery+webservice实现无刷新回复留言,功能已经实现,但只有每页的第一行才能成功回复留言
<script type="text/javascript">
var pageNo = 1; //当前页号
var pageItems = 3; //每页显示的行数,这个数字与da.Fill(ds,pageNo,3,"gbook");里面的3保持一致
var MaxPage = pageItems;
function showPage(m) {
if (m == -1) {
if (pageNo < 2) {
alert("已经到了首页");
return;
};
MaxPage = pageItems;
}
else {
if (MaxPage < pageItems) {
alert("已经到了末页");
return;
};
}
pageNo += m;
getData();
}
$(document).ready(function () {
getData();
});
function getData() {
$.ajax({
type: "POST",
cache: false,
url: "WebService.asmx/Select", /* 注意后面的名字对应CS的方法名称 */
data: { "pageNo": (pageNo - 1) * pageItems }, /* 注意参数的格式和名称 */
contentType: "application/x-www-form-urlencoded",
dataType: "xml",
error: function (result) {
alert(result.responseText);
},
success: function (data) {
MaxPage = $(data).find('gbook').size();
t = "<table border='1'>";
$(data).find('gbook').each(function (index, ele) {
var id = $(ele).find('id').text();
var title = $(ele).find('title').text();
var name = $(ele).find('name').text();
var time = $(ele).find('time').text();
var content = $(ele).find('content').text();
var reptime = $(ele).find('reptime').text();
var repcontent = $(ele).find('repcontent').text();
t += "<tr>";
t += "<td>" + id + "</td>";
t += "<td>" + title + "</td>";
t += "<td>" + name + "</td>";
t += "<td>" + time + "</td>";
t += "<td>" + content + "</td>";
t += "<td>" + reptime + "</td>";
t += "<td>" + repcontent + "</td>";
t += "<td> <input type=button value='删除此留言' onclick='deleteData(" + id + ")'/></td><td><textarea id='TextArea1'></textarea><input type=button value='回复此留言' onclick='replyData(" + id + ")'/></td>";
//t += "<td> <input type=button value='删除此留言' onclick='deleteData(" + id + ")'/></td><td><input type=button value='回复此留言' onclick=='disp_alert()'/></td>";
t += "</tr>&q