title: JQuery JSON read and print $.getJSON
body: <p>This is something new to me so please be patient. JQuery &amp; json  - I have been using json &amp; serialize  for "ages" in php but just getting into JQ.  I want to pass data cross domain- so json array seems best to me but how to I display it e.g.</p>
  
  <p>say I have a json array like this created in php on page name examplearray.php located at <a href="http://domain1.com/examplearray.php" rel="nofollow">http://domain1.com/examplearray.php</a></p>
  
  <pre><code>    $catarray = array('Animal Life','Business &amp;amp; Finance','Cars &amp;amp; Vehicles','Entertainment &amp;amp; Arts','Food &amp;amp; Cooking','Health','History, Politics &amp;amp; Society','Hobbies &amp;amp; Collectibles','Home &amp;amp; Garden','Humor &amp;amp; Amusement','Jobs &amp;amp; Education','Law &amp;amp; Legal Issues','Literature &amp;amp; Language','Relationships','Religion &amp;amp; Spirituality','Science','Shopping','Sports','Technology','Travel &amp;amp; Places'); 
  $callback =  json_encode($catarray);
  </code></pre>
  
  <p>I understand I can call it like this from another domain say <a href="http://domain2.com" rel="nofollow">http://domain2.com</a></p>
  
  <pre><code>$(document).ready(function(){
  $.getJSON("http://domain1.com/examplearray.php?callback=",
  function(data){
  $.each(data, function(i,item)
  {  
  // WHAT DO I put in here to read the array? i.e. what are the keys etc. //
  // I assume the display is something like $('#element').html('something');
  });
  });
  });
  </code></pre>
  
  <p>In the above example there are no "set" keys if you follow that , but now add a key to the array like this </p>
  
  <pre><code>$catarray = array('keyname' =&gt; array('Animal Life','Business &amp;amp; Finance','Cars &amp;amp; Vehicles','Entertainment &amp;amp; Arts','Food &amp;amp; Cooking','Health','History, Politics &amp;amp; Society','Hobbies &amp;amp; Collectibles','Home &amp;amp; Garden','Humor &amp;amp; Amusement','Jobs &amp;amp; Education','Law &amp;amp; Legal Issues','Literature &amp;amp; Language','Relationships','Religion &amp;amp; Spirituality','Science','Shopping','Sports','Technology','Travel &amp;amp; Places'));
  </code></pre>
  
  <p>Help much appreciated, thanks.</p>