Javascript calls to an Ajax WebMethod. How to get multiple output params returned?

Posted by George on Stack Overflow See other posts from Stack Overflow or by George
Published on 2010-04-24T06:47:04Z Indexed on 2010/04/24 6:53 UTC
Read the original article Hit count: 312

Filed under:
|

OK, I know how to call a simple old fashion asmx webservice webthod that returns a single value as a function return result. But what if I want to return multiple output params? My current approach is to separate the params by a dividing character and parse them on teh client. Is there a better way.

Here's how I return a single function result. How do I return multiple output values?

<asp:ScriptManager ID="ScriptManager1" runat="server">
    <Services>
        <asp:ServiceReference Path="WebService.asmx" />
    </Services>

    function CallHelloWebMethod() {
        WebService.Hello(OnComplete1, OnTimeOut, OnError);
    }

    function OnComplete1(arg) {

        alert(arg);

    }

    function OnTimeOut(arg) {
    }

<WebMethod()> Public Function Hello(ByVal x As String) As String
    Return "Hello " & x 
End Function

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about ASP.NET