calling WCF using AJAX and jquery

Mani5155
Posted by Mani5155 under ASP.NET AJAX category on | Points: 40 | Views : 2920
$.ajax({
type: "POST",
dataType: "json",
url: "../Service1.svc/myservice",
data: '{ 'field_name=" '+'value'+'",'....}', //for passing json formatted input(argument) to method 'myservice'
contentType: "application/json; charset=utf-8",
success: function (r) {
alert(eval('(' + r.d.toString() + ')')); //your output also in json format only
},
error: function (e) {
alert("your error message");
}

});

In above code you can call WCF using ajax with json formatted input and json formatted output

Comments or Responses

Posted by: Vinay13mar on: 10/15/2012 Level:Starter | Status: [Member] | Points: 10
Hi.
Check the below link this will help you
http://www.dotnetpools.com/Article/ArticleDetiail/?articleId=33&title=How%20To%20Make%20Ajax%20Call%20Using%20Jquery%20in%20Asp.Net

Login to post response