var pageIndex = 1;
var pageCount;
var categoryid = 0;
var brandtext = null;
var pricevalue = 0;
$(document).ready(function () {
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
GetRecords();
}
});
$('.clbtnmenu').click(function () {
categoryid = $(this).data('id');
pageIndex = 1;
});
});
function GetRecords() {
pageIndex++;
/*retrieving Text from rblbrands if checked*/
if ($('#<%=rblbrands.ClientID %> input:checked').val() != null) {
var checked_radiobrands = $("[id*=rblbrands] input:checked");
//brandsvalue = checked_radiobrands.val();
brandtext = checked_radiobrands.closest("td").find("label").html();
}
if ($('#<%=rblpricerange.ClientID %> input:checked').val() != null) {
var checked_radioprice = $("[id*=rblpricerange] input:checked");
pricevalue = checked_radioprice.val();
//pricetext = checked_radioprice.closest("td").find("label").html();
}
alert('PageIndex : ' + pageIndex + ' , Page Count : ' + pageCount + ' , CategoryId : ' + categoryid + " , BrandText : " + brandtext + " , PriceValue :" + pricevalue);
if (pageIndex == 2 || pageIndex <= pageCount) {
$("#loader").show();
$.ajax({
type: "POST",
url: "WebForm1.aspx/GetCustomers",
data: JSON.stringify({ 'pageindex': pageIndex, 'categoryid': categoryid, 'brand': brandtext, 'price': pricevalue }),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert('Hell 1');
},
error: function (response) {
alert('Hell 2');
}
});
}
}