JQuery promise with getJSON and callback - Javascript jQuery

Javascript examples for jQuery:Json

Description

JQuery promise with getJSON and callback

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from  w  ww  . ja  va2 s  .  c  om*/
$.getJSON("/echo/json").success(function(data) {
  console.log("first: " + new Date().getTime());
}).then(function() {
  console.log("second:" + new Date().getTime())
});
    });

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

Related Tutorials