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, 3:57 AM EDT
Brilliant.
Bok Joo ReyesPosted Apr 4, 2017, 11:57 PM EDT
What is the meaning of data.d? why it has .d?
kalu singh raoPosted Jul 7, 2016, 9:25 PM EDT
Nice...
matteo marginiPosted Jun 3, 2015, 7:02 AM EDT
Visual Studio give an error when i write "using System.Web.Services;"
Sanjay KumarPosted Apr 1, 2014, 7:54 AM EDT
Nice Article
Ibrahim ErsoyPosted Apr 1, 2014, 6:01 AM EDT
Great!