Fetch JSON File - Javascript jQuery

Javascript examples for jQuery:Json

Description

Fetch JSON File

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>JSON</title> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> 
  <script type="text/javascript">
$(function() {// w  w w. j av a 2 s .  c  o m
    $("button").click( function() {
        $.getJSON( "json_data.json", function(obj) {
            $.each(obj, function(key, value) {
                $("ul").append("<li>"+value.name+"</li>");
            });
        });
    });
});

      </script> 
 </head> 
 <body> 
  <ul></ul> 
  <button>Refresh</button>  
 </body>
</html>

Related Tutorials