title: ASP.NET Javascript to web service get return value outside of callback function
body: <p>I have a ASP.NET web service which is returning a simple string value, I'm calling this web service through javascript using the script manager, everything is working fine, however, I need the return value from the location where I call the web service, and "not" from the callback function.</p>
  
  <p>Something like this (sorry for the bad pseudo code)</p>
  
  <pre><code>function something() {
  scriptmanager.webservice.method1(param, OnSuccess);
  }
  function OnSuccess(retVal) {
  retVal &lt;-- I need to do more with this, from within the "something" function above. Building an array for example calling this service multiple times.
  }
  </code></pre>
  
  <p>I've tried creating a global javascript variable outside the functions, and assigning it in the OnSuccess function, but it always comes up undefined from the "something" function.</p>
  
  <p>All of the examples out there usually change something visually on the page and don't really do something useful with the web service return value, how do I get the return value back up to the main calling "something" function?</p>