Atalasoft
Welcome to Atalasoft Community Sign in | Join | Help

RemoteInvoke - Specifying the javascript return function?

  •  23 May 2007, 11:25 AM

    RemoteInvoke - Specifying the javascript return function?

    Hi,

    I've been using the RemoteInvoke functionality of WebImageViewer... and so far it's great.

    But I was wondering if it is possible to define the javascript function which would handle the result?  From the documentation, I can see that it is possible to use a generic function for all return values as such:

    WebImageViewer1.RemoteInvoked = OnRemoteInvoked;
    function OnRemoteInvoked(){
       var success = WebImageViewer1.getReturnValue();
       if (success == true){
          alert('WaterMark Succeeded.');
       }
       else {
          alert('WaterMark Failed.')
       }
    }

    In Ajax.Net 2.0 (or whatever it's called today), you can use WebMethod's, specifying which JavaScript function will handle the returned result:

    PageMethods.SomeServerSideMethod( SomeParameter, SomeOtherParameter, JavaScriptReturnHandler);

    However, using this with WebImageViewer means somehow passing a reference back through as it seems WebMethod's must be static, blocking access to any page objects (unless they're session'd, which I'd prefer not).

    Alternatively, I could pass back a comma-delimited (or something safer) string and use the generic handler.

    /ramble


    Moo!
    Filed under:
View Complete Thread