Here is the code for calling a web service using jQuery
<html>
<head id="Head1" runat="server">
<title>ASP.NET AJAX Web Services: Web Service Sample
Page</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jQuery/1.2.6/jQuery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function() {
$("#btnTest").click(function(event) {
$.ajax({
type: "POST",
url: "dummyWebsevice.asmx/HelloToYou",
data: "{'name': '" + $('#name').val() + "'}",
contentType: "application/json;
charset=utf-8",
dataType: "json",
success: function(msg)
{
AjaxSucceeded(msg);
},
error: AjaxFailed
});
});
});
function AjaxSucceeded(result) {
alert(result.d);
}
function AjaxFailed(result) {
alert(result.status + ' ' +
result.statusText);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h1> Calling Web Services using jQuery </h1>
Enter your name:
<input id="name" />
Andrew FensterPosted Apr 5, 2011, 12:19 PM
That's a good article. Very helpful. It looks like Microsoft finally stopped development of the ASP.Net Ajax library. So jQuery is probably the way to go in the future.