开发者

Accessing a web service from the client code (Java Script) [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it c开发者_开发问答an be reopened, visit the help center. Closed 11 years ago.

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)

  1. Writing a script method to display and invoke the methods of the service

  2. 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()); 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜