title: how to print the associative array in print_r() fashion from a $.getJSON call?
body: <p>simple thing.</p>
  
  <p>$.getJSON is used and the result from the .php file being called is caught as response in the jquery callback function. The json encoded php array is an associative array.</p>
  
  <pre><code>$.getJSON("file.php",function(response){
  
  // print the associative response array in var_dump or print_r fasion
  
  });
  </code></pre>
  
  <p>file.php contains:</p>
  
  <pre><code>&lt;?php
  
  $my_array=array();
  
  //$my_array['random_index1']="random_value1";
  
  //$my_array['random_index2']="random_value2";
  
  //$my_array['random_index3']="random_value3";
  // and so on
  
  
  echo json_encode($my_array);
  
  
  ?&gt;
  </code></pre>
  
  <p>$my_array has random keys and values.</p>
  
  <p>How can I print the whole 'response' array just like the print_r fashion in php?</p>
  
  <p><strong>EDIT1:</strong> I want to print it on the webpage or in an alert box. Not that i just want to watch the values in the javascript console(chrome, FF or whatever).</p>
  
  <p><strong>EDIT2:</strong> if I write the body of $.getJSON as follows: why won't it work:</p>
  
  <pre><code>    for(var i in response){
  
      console.log("i="+i+" content="+response[i]);
  
  }
  </code></pre>