项目中需要用到无刷新分页 AspNetPager本身提供的ajax只支持微软的ajaxtools,于是动手小小改动了一下,由于是初版 也许会有点见谅。
代码
<script>
//物品类别ID
var classID=null;
$(
function()
{
Init();
}
);
function Init()
{
//处理分页控件
$("#AspNetPager1").children("a").each(function(index,element){
$(element).unbind("click");
if(element.href!="")
{
//获取分页按钮的超链接
var link=element.href;
//alert(classID);
//分页点击事件用ajax将连接提交
$(element).bind("click",function(){
$.ajax({
type:"get",
cache:false,
url:link,
dataType:"html",
success:function(msg){
$('#showForm').html($(msg).filter('#showForm').html())
//$(document).unbind( "click" ) ;
//对新加载的数据 再次进行处理
Init();
}
});
});
}
//让超链接不发生跳转
element.href="#";
});
}
</script>
//物品类别ID
var classID=null;
$(
function()
{
Init();
}
);
function Init()
{
//处理分页控件
$("#AspNetPager1").children("a").each(function(index,element){
$(element).unbind("click");
if(element.href!="")
{
//获取分页按钮的超链接
var link=element.href;
//alert(classID);
//分页点击事件用ajax将连接提交
$(element).bind("click",function(){
$.ajax({
type:"get",
cache:false,
url:link,
dataType:"html",
success:function(msg){
$('#showForm').html($(msg).filter('#showForm').html())
//$(document).unbind( "click" ) ;
//对新加载的数据 再次进行处理
Init();
}
});
});
}
//让超链接不发生跳转
element.href="#";
});
}
</script>