title: how to access ajax variable out side from the ajax
body: <pre><code>$(document).ready(function() {
  
              var items;
  
               $.ajax({
                  url: 'item/getProducts',
                  dataType: 'json',
                  success: function(data){
                  items=data;
                  console.log(data); //this code work and show the data
                  }
              });
      console.log(items);// display undefined 
  
  });
  </code></pre>
  
  <p>i'm trying to access items variable out side of the ajax block .but when i console it it display undefined 
  how can i access items variable ??</p>