Aniruddh Kewat

Aniruddh Kewat

  • NA
  • 30
  • 19.9k

how to send multiple parameters to web method ?

Jun 18 2015 12:22 AM
this is my code...
 
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');
         //alert("Id : " + categoryid);
      });
});
function GetRecords() {
pageIndex++;
/*retrieving text from rblbrands*/
var checked_radiobrands = $("[id*=rblbrands] input:checked");
//brandsvalue = checked_radiobrands.val();
brandtext = checked_radiobrands.closest("td").find("label").html();
/*retrieving text from rblpricerange*/
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: '{pageindex:' + pageIndex + 'CategoryId:' + categoryid + 'Brand:' + brandtext + 'Price:' + pricevalue +'}',
data: {pageindex: pageIndex,CategoryId: categoryid,Brand: brandtext,Price: pricevalue},
//data: { pageIndex: pageIndex, CategoryId: categoryid },
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert('Hell 1');
},
error: function (response) {
alert('Hell 2');
}
});
}
}
 
 
this is alerting: Hell 2 ......
 
 

Answers (4)