In this tutorial, I am going to show you how to call WebMethod with Jquery in ASP.NET WebForms. This post will cover a basic example to post form data using Jquery in ASP.NET.

Calling a WebMethod with jQuery in ASP.NET WebForms:

Let’s create a simple example.

Step 1 Create an ASP.NET Web Form Application:

Open Visual Studio and go to File>New>Project and create ASP.NET Web Application PostFormData


Choose an Empty Web Form Template as shown in the below image.


An empty application has been created.

Step 2: Add Web Form to the application.

Right Click on the Solution Explorer and add a WebForm called Default.aspx. Write the following code in the Default.aspx.

The url “”/Default.aspx/Greeting” is the name of WebForm and “Greeting” is the name of WebMethid.

Step 3: Declaring  WebMethod in Code Behind:

Add the following namespace.

Add the following WebMethod in the Code Behind file.

Note: The WebMethod must be static.

Run the application:


View More:


Hope you understand this tutorial. Please don’t hesitate to comment for any technical issue. Your feedback and suggestions would be helpful.

Thank You.