JQuery iterate over array of dictionaries - Javascript jQuery

Javascript examples for jQuery:Array

Description

JQuery iterate over array of dictionaries

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-compat-git.js"></script> 
  <script type="text/javascript">
    $(window).on('load', function() {
var obj=  [{'id': '111', 'name': 'test1'}, {'id': '1975', 'name': 'test2'}]
$(obj).each(function(index,value){
    console.log("index: " + index + ",  id: " + value.id + ",  name: " + value.name);
});// ww w  .jav  a  2s  .co m
    });

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

Related Tutorials