title: JSON response data length getting undefined error in Ajax?
body: <p>I want to get the length of <code>language</code> in JavaScript alert box - </p>
  
  <p>See screenshot-</p>
  
  <p>Ajax Response - </p>
  
  <p><img src="https://i.stack.imgur.com/565Q8.png" alt="enter image description here"></p>
  
  <p><img src="https://i.stack.imgur.com/HrcL3.png" alt="enter image description here"></p>
  
  <p>My Ajax code - </p>
  
  <pre><code>function search_menu(){
      $.ajax({
          type: 'post',
          url: rootUrl() + "rest_apis/search_menu.json", 
          cache: false,        
          success: function(res){ //alert(data.data[0].language[142]);
              var len = res.data[0].language.length; 
              alert(len); //Showing undefined
          },
          contentType: 'application/json',
          dataType: 'json'
      });
  }
  </code></pre>
  
  <p>I am just alerting <code>alert(lang)</code> its showing undefined. Actually in language having 36 record. why its showing <code>undefined</code>?</p>