Accessing a web service from the client code (Java Script) [closed]
How and which tasks need to be done for accessing a web service from the client code (Java Script)? Please help.
if it is ASP.net then following are the steps (http://msdn.microsoft.com/en-us/magazine/cc163354.aspx)
Writing a script method to display and invoke the methods of the service
Assign result to HTML elements
Here is the code,
<script src="WebService.asmx/jsdebug" type="text/javascript"></script>
function OnMethodSucceeded(result, eventArgs)
{
var label = Sys.UI.DomElement.getElementById('Label1');
var sb = new Sys.StringBuilder();
sb.append('You got back a value of ');
sb.append(result.toString());
label.innerHTML = sb.toString();
}
function OnMethodFailed(error)
{
alert(error.get_message());
}
精彩评论