Return value from inside a function with done() - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:done

Description

Return value from inside a function with done()

Demo Code

ResultView the demo in separate window


<html>
   <head> 
      <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script> 
   </head> 
   <body> 
      <script>
var d =  $.Deferred();//w ww. j av a  2 s . c om
var myResult=null;
d.done(function (a){ 
   myResult=a;
}) .done(function (){ 
   console.log(window["myResult"])
});
d.resolve(1);

      </script>  
   </body>
</html>

Related Tutorials