Here is simple example how to call a web service using Jquery AJAX. Pretty simple HTML file.
The method 'Get' is used to request the data from the server.
<html>
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.9.1.js" type="text/javascript"></ script>
<script type="text/javascript">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.9.1.js" type="text/javascript"></
<script type="text/javascript">
function InvokeAJAXWebService() {
$.ajax( {
type:'Get',
url:'http://www.site.com/ mywebservice',
success:function(data) {
alert(data);
}
$.ajax( {
type:'Get',
url:'http://www.site.com/
success:function(data) {
alert(data);
}
});
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<button id="btnExample" runat="server" onclick="InvokeAJAXWebService( );">
JQuery AJAX Web Service Example</button>
</div>
</form>
</body>
</html>
</head>
<body>
<form id="form1" runat="server">
<div>
<button id="btnExample" runat="server" onclick="InvokeAJAXWebService(
JQuery AJAX Web Service Example</button>
</div>
</form>
</body>
</html>
No comments:
Post a Comment