Get specific element in JSON - Javascript JSon

Javascript examples for JSon:JSon String

Description

Get specific element in JSON

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {//from w ww.  j av a2s . com
var response = {results: 123, id: 456};
var div = document.createElement("div");
div.innerHTML = "id: " + response.id + " results: " + response.results;
document.getElementsByTagName("body")[0].appendChild(div);
    });

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

Related Tutorials