Jquey with Webservice in asp.net
how to call webservice from JQuery
please find following steps
Please find following steps for
- Create one WebService in asp.net project with DummyTest.asmx
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [System.ComponentModel.ToolboxItem(false)]
- Create one Webmethod with SessionEnable = true
[Webmethod(EnableSession=true)]
Public string HelloWorld(string name)
{
//apply your logic here
Return “Hello World” + name;
}
- Come to aspx page and add jQuery Library at top of the page
<script languge=”javascript” src=”jquery-1.3.2.js” ></script>
<script languge=”javascript” src=”jquery-ui-1.7.2.min.js” ></script>
- ajax method parameters
Type: “Post” or “Get”
URL : your web service file name /Method name
Data : paramert data for webmethod
contentType: "application/json; charset=utf-8"
dataType: "json"
success : function
error : function
Comments