Posted on: 2/12/2015 5:27:29 PM | Views : 491

HI,
    Even though there are lots of example regarding the above subject, kindly guide me in the below example.
I have a webpage named Default.aspx and a class file named Class1.cs
I have my web methods in Class1.cs as follows.
[WebMethod] public string SayHello(string firstName) { return "Hello " + firstName ; } My HTML in Default.aspx looks as below.
<script type="text/javascript"> function sm() { var fn = document.getElementById("fn").value; $.ajax({ type: "POST", url: '<%= ResolveUrl("~/Default.aspx/SayHello") %>', data: { firstName: fn}, contentType: "application/json; charset=utf-8", dataType: "json", ...

Go to the complete details ...