Monday, November 24, 2008

Consuming .net webservices with Jquery in JASON format.

1) Add [ScriptService] attribute to your webservice.

2) Call your method with JQuery. Very Simple!

$.ajax({
type: "POST",
url: "ServiceName.asmx/WebMethodName",
data: "{'parameter1':'p1','parameter2':'p2'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
// Do
 stuff
}
});

Technorati Tags: ,,,,

No comments: