totalbeginner 0 Posted October 1, 2014 Report Share Posted October 1, 2014 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title></title> <script src="https://code.oovoo.com/webrtc/oovoosdk-0.0.7.min.js"></script> <script type="text/javascript"> function TestId() { WebService1.GetAppId(onSuccess, onFailure); } //situation 1 function onSuccess(result) { alert(result); } //situation 2 //function onSuccess(result) { // return result; //} function onFailure(result) { alert("Error Invoking the Web Service..."); } </script> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager runat="server" ID="scriptManager"> <Services> <asp:ServiceReference Path="~/WebService1.asmx" /> </Services> </asp:ScriptManager> <div> <video id="localVideo" style="width: 300px; height: auto;" autoplay muted></video> </div> </form> <script type="text/javascript"> TestId(); // This line is working in situation 1 (onSuccess method situation 1) //BUT, WHEN I COMMENT METHOD IN SITUATON 1 AND UNCOMMENT SITUATION2 THEN LINE BELOW IS NOT WORKING var a = TestId(); //THIS LINE IS NOT WORKING WHEN SITUATION2 IS ACTIVE </script> </body> </html> Quote Link to post Share on other sites
justsomeguy 1,135 Posted October 1, 2014 Report Share Posted October 1, 2014 What do you mean it is not working? What exactly do you expect to happen, and what is actually happening? If you expect the TestId function to return the result from the onSuccess function, that will not happen. Quote Link to post Share on other sites
Hadien 39 Posted October 5, 2014 Report Share Posted October 5, 2014 well for one thing testId() doesn't have a return command so "var a" will always be undefined. add a return statement in testId() and start working from there. function TestId() { return WebService1.GetAppId(onSuccess, onFailure);} Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.