the data will be loaded on scroll down event but it is not append to the datalist
plz help me.
my code is
<script type="text/javascript">
var pageIndex = 1;
var pageCount;
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetRecords();
}
});
function GetRecords() {
pageIndex++;
if (pageIndex == 2 || pageIndex <= pageCount) {
$("#loader").show();
$.ajax({
type: "POST",
url: "Collapsepage.aspx/GetCustomers",
data: '{pageIndex: ' + pageIndex + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert("failure"+response.d);
},
error: function (response) {
alert(response.d);
}
});
}
}
function OnSuccess(response) {
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
pageCount = parseInt(xml.find("PageCount").eq(0).find("PageCount").text());
var customers = xml.find("Customers");
customers.each(function () {
var customer = $(this);
var table = $("#dlistcmplist table").eq(0).clone(true);
$(".CName", table).html(customer.find("CName").text());
$(".BID", table).html(customer.find("BID").text());
$(".STD", table).html(customer.find("STD").text());
$(".SLName", table).html(customer.find("SLName").text());
$(".LName", table).html(customer.find("LName").text());
$(".CGName", table).html(customer.find("CGName").text());
$(".CLogo", table).html(customer.find("CLogo").text());
$(".B_Addr", table).html(customer.find("B_Addr").text());
$(".BrdNo", table).html(customer.find("BrdNo").text());
$(".MbleNo", table).html(customer.find("MbleNo").text());
$(".TFN", table).html(customer.find("TFN").text());
$(".rate", table).html(customer.find("rate").text());
$(".StCount", table).html(customer.find("StCount").text());
$(".Other", table).html(customer.find("Other").text());
$(".PageIndex", table).html(customer.find("PageIndex").text());
$(".PageText", table).html(customer.find("PageText").text());
$(".CCount", table).html(customer.find("CCount").text());
$(".CGID", table).html(customer.find("CGID").text());
$(".SMSNO", table).html(customer.find("SMSNO").text());
$("#dlistcmplist").append(table).append("
");
GetReloadUpdatePanel()
alert("success" + response.d);
});
$("#loader").hide();
}
</script>