MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » JQuery无刷新分页,该如何处理

JQuery无刷新分页,该如何处理(3)

www.MyException.Cn  网友分享于:2013-01-14  浏览:335次

<head >
<title></title>
<link href="jqueryPager/pagination.css" rel="stylesheet" type="text/css" />
<script src="jqueryPager/jquery-1.2.6.pack.js" type="text/javascript"></script>
<script src="jqueryPager/jquery.pagination.js" type="text/javascript"></script>

<script type="text/javascript">


var orderby="";

$().ready(function() {
InitData(0);

$("#pageTheme").change(function(){
$("#Pagination").attr('class',$(this).val());
});

});

function pageselectCallback(page_id, jq) {
// alert(page_id);
InitData(page_id);
}

function InitData(pageindx)
{
var tbody = "";

$.ajax({
type: "POST",//用POST方式传输
dataType:"json",//数据格式:JSON
url:'handler.ashx',//目标地址
data:"p="+(pageindx+1)+"&orderby="+orderby,
beforeSend:function(){$("#divload").show();$("#Pagination").hide();},//发送数据之前
complete:function(){$("#divload").hide();$("#Pagination").show()},//接收数据完毕
success:function(json) {
$("#productTable tr:gt(0)").remove();
var productData = json.Products;
$.each(productData, function(i, n) {
var trs = "";
trs += "<tr><td>" + n.orderid + "</td><td>" + n.customerid + "</td><td>" + n.shipname + "</td><td>" + n.shipcity + "</td></tr>";

tbody += trs;
});

$("#productTable").append(tbody);

$("#productTable tr:gt(0):odd").attr("class", "odd");
$("#productTable tr:gt(0):even").attr("class", "enen");


$("#productTable tr:gt(0)").hover(function(){
$(this).addClass('mouseover');
},function(){
$(this).removeClass('mouseover');
});
}});

$("#Pagination").pagination(<%=pagecount %>, {
callback: pageselectCallback,
prev_text: '« Previous',
next_text: 'Next »',
items_per_page:20,
num_display_entries:6,
current_page:pageindx,
num_edge_entries:2
});

}

function Sort(ordercolumn,ordertipid)
{

var ordertype="";//1:desc,0:asc
var $orderimg = $("#"+ordertipid);
if($orderimg.html()!="")
{
var imgsrc = $("img",$orderimg).attr("src");

if(imgsrc.indexOf("asc")>-1){
$(".ordertip").empty();
$orderimg.html("&nbsp;<img src=\"images/sort_desc.gif\" align=\"absmiddle\">");

ordertype = 1;

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有