Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass int values to ASP.NET page methods from jQuery?

I am using ASP.NET page methods with jQuery. Here is my code,

$.ajax({
      type: "POST",
      url: "Default.aspx/GetRecords",
      data: "{}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",

and the ASP.NET page method is,

[WebMethod]
public static string GetRecords(int currentPage,int pagesize)
{
    // my logic here
}

How to pass values for currentPage and pagesize from jQuery?

like image 515
ACP Avatar asked Mar 30 '10 04:03

ACP


1 Answers

I got it working. My data section must be

data: "{'currentPage':1,'pagesize':5}",
like image 117
ACP Avatar answered Nov 03 '22 00:11

ACP