title: Iterating through a PHP array in jQuery?
body: <p>How do I iterate through a PHP array in jQuery? I have an array in php named <code>$viewfields</code>.
  How do I iterate through each element of this array using jQuery?</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <pre><code>&lt;?php foreach ($viewfields as $view): ?&gt;           
  
  if(&lt;?=$view['Attribute']['type'];?&gt;=='text'||&lt;?=$view['Attribute']['type'];?&gt;=='number')
  { 
       $("&lt;input id=input&lt;?=$view['Attribute']['sequence_no'];?&gt; type= 'text' style= 'width:&lt;?=$view['Attribute']['size'];?&gt;px' data-attr=&lt;?=$view['Attribute']['type'];?&gt; &gt;&lt;/input&gt;&lt;br&gt;").appendTo("#fb_contentarea_col1down21 #&lt;?=$view['Attribute']['sequence_no'];?&gt;");
  }
  </code></pre>
  
  <p>If i give </p>
  
  <pre><code>$.each(arrayfromPHP,function(i,elem){
  
  }
  </code></pre>
  
  <p>how do I write the code for $view['Attribute']['type'] in jQuery?
  elem['Attribute']['type'] won't work I suppose?</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>elem['Attribute']['type'] does work </p>