Introduction
I will use the jQuery.ajax() or $.ajax() method to call the C# method (WebMethod). The $.ajax() method does an asynchronous HTTP (Ajax) request. This method will take various parameters. So you will get the entire parameters list in a link: https://api.jquery.com/jQuery.ajax/
You need to add the jQuery library to your project in order to run this jQuery Ajax call. You can download the jQuery library from this link: http://jquery.com/download/
Here is the jQuery Script.

Here is the C# function.

Output

Note
- Here I declared the C# method as WebMethod and it should be static.
- If this method is not static then you will get an error and the method will never be called.
- Download the code to test this $.ajax() functionality.

Omar AlnaymePosted Apr 18, 2020, 7:57 AM
Brilliant.
Bok Joo ReyesPosted Apr 5, 2017, 3:57 AM
What is the meaning of data.d? why it has .d?
kalu singh raoPosted Jul 8, 2016, 1:25 AM
Nice...
matteo marginiPosted Jun 3, 2015, 11:02 AM
Visual Studio give an error when i write "using System.Web.Services;"
Sanjay KumarPosted Apr 1, 2014, 11:54 AM
Nice Article
Ibrahim ErsoyPosted Apr 1, 2014, 10:01 AM
Great!