This article gives you step by step example for implementing Page Method and calling it through jQuery.ajax() call.
This example will read data from Customer table of Northwind database. You can download the Northwind database here. Depending on the selected Country value of DropDown, Customer details will be rendered if jQuery.ajax() call returns success.
- Default.aspx - has a DropDownList to display list of countries. On selection of specific country, customers from selected country will be fetched by jQuery Ajax call and shown in HTML table.
- Default.aspx.cs- has a Web Method to return list of customers depending on selected country and return a response to jQuery Ajax call.
- Customer.cs - it is customer model used to create a list of customers and return it as response.
Below picture shows all customers from selected country - UK
For more details on how to use pagemethod / webmethod with jQuery Ajax call in ASP.NET