I have two simple projects in a single Visual Studio solution to understand how a ajax request works. One is a web service and the second one is a project consuming the web service. Here are the relevant code snippets.
Web Service #1st Project
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
//ajax call
[System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string getValue(string txt)
{
return txt;
}
}
Consuming Application #2nd Project
JQuery Ajax
Go to the complete details ...