Access the json response from xhr in jquery - Javascript jQuery

Javascript examples for jQuery:Json

Description

Access the json response from xhr in jquery

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 v  a  2 s . co m*/
$('.log').ajaxSuccess(function(event, xhr, settings) {
    console.log(xhr instanceof XMLHttpRequest);
    $(this).text(xhr instanceof XMLHttpRequest);
});
$.getJSON('/echo/json/');
    });

      </script> 
 </head> 
 <body> 
  <div class="log"></div>  
 </body>
</html>

Related Tutorials