Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
XML
Hi all,

I want to call remote web service using Jquery? My code is given below.

<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$('#Save').click(TestingMethod);
}
);
function TestingMethod() {
var BizName = $('#txtBizName').val();
var webMethod = "http://MyWebService/offlinecourse.asmx/TestingMethod";
var parameters = "{str:'" + BizName + "'}";
$.ajax({
url: webMethod,
type: "POST",
dataType: "json",
data: parameters,
contentType: "application/json; charset=utf-8",
success: function(msg) {
$('#status').html('Input is : ' + msg.d);
},
error: function(e) {
$('#status').html = "Unavailable";
}
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input type="text" id="txtBizName" />
<input type="button" id="Save" value="Save" />
<div id="status">
</div>
</form>
</body>
</html>
Posted
Updated 9-Feb-14 18:58pm
v2
Comments
thatraja 10-Feb-14 2:55am    
what's the problem?

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900