I have created ajax code for my city tabs to display respective city data from ajax.
我为我的城市选项卡创建了ajax代码,以显示来自ajax的相应城市数据。
I have used following code:
我使用了以下代码:
function showBrandData(str)
document.getElementById("dvloader").style.display = 'block';
jQuery('#txtDisplayBrands').slideDown("slow");
if (str=="")
{
document.getElementById("txtDisplayBrands").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("dvloader").style.display = 'none';
document.getElementById("txtDisplayBrands").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://localhost/demostore/getBrandData.php?q="+str+"&page=1",true);
xmlhttp.send();
}
Following is my div to load above ajax contents
以下是我的div加载ajax内容
<!-- div to display brands products -->
<div id="txtDisplayBrands"></div>
Now I have used following jquery plugin to paginate my items http://cssglobe.com/post/9801/easy-paginate-jquery-plugin-for-pagination
现在我使用了以下jquery插件来分页我的项目http://cssglobe.com/post/9801/easy-paginate-jquery-plugin-for-pagination
but when I used this on my ajax responce the pagination does not work.
但是当我在我的ajax响应时使用它时,分页不起作用。
Can you please help me where I am doing wrong.
你能不能帮助我做错的地方。
Thanks & Regards
感谢和问候
1 个解决方案
#1
0
The default code from that site:
该站点的默认代码:
<script type="text/javascript">
jQuery(function($){
$('ul#items').easyPaginate();
});
</script>
Gets called on page load. Your ajax call is getting executed after that so you need to call the pagination code on the elements you load in your ajax call.
在页面加载时调用。之后你的ajax调用正在执行,所以你需要调用你在ajax调用中加载的元素的分页代码。
Consider adding it within the if statement if (xmlhttp.readyState==4 && xmlhttp.status==200)
考虑在if语句中添加它if(xmlhttp.readyState == 4 && xmlhttp.status == 200)
#1
0
The default code from that site:
该站点的默认代码:
<script type="text/javascript">
jQuery(function($){
$('ul#items').easyPaginate();
});
</script>
Gets called on page load. Your ajax call is getting executed after that so you need to call the pagination code on the elements you load in your ajax call.
在页面加载时调用。之后你的ajax调用正在执行,所以你需要调用你在ajax调用中加载的元素的分页代码。
Consider adding it within the if statement if (xmlhttp.readyState==4 && xmlhttp.status==200)
考虑在if语句中添加它if(xmlhttp.readyState == 4 && xmlhttp.status == 200)