Print the results from a multidimensional array through jquery post
<p>How i can print the results from a multi-dimensional array through jquery before appending it to the results div?</p>

<p>My jquery looks like this:</p>

<pre><code>$.post('search.php', { q: $q.val() }, function(data) {
   showResults(data,$q.val());
        runningRequest=false;
  });

  //Create HTML structure for the results and insert it on the result div
  function showResults(data, highlight){
       var resultHtml = '';
        $.each(data, function(i,item){
            resultHtml+='&lt;div class="result"&gt;';
            resultHtml+=item.i.title;
            //resultHtml+='&lt;h2&gt;&lt;a href="#"&gt;'+item.title+'&lt;/a&gt;&lt;/h2&gt;';
            //resultHtml+='&lt;p&gt;'+item.post.replace(highlight, '&lt;span class="highlight"&gt;'+highlight+'&lt;/span&gt;')+'&lt;/p&gt;';
            //resultHtml+='&lt;a href="#" class="readMore"&gt;Read more..&lt;/a&gt;'
            resultHtml+='&lt;/div&gt;';
        });

        $('div#results').html(resultHtml);//resultHtml
    }
  $.post('search.php', { q: $q.val() }, function(data) {
   showResults(data,$q.val());
        runningRequest=false;
  });

  //Create HTML structure for the results and insert it on the result div
  function showResults(data, highlight){
       var resultHtml = '';
        $.each(data, function(i,item){
            resultHtml+='&lt;div class="result"&gt;';
            resultHtml+=item.i.title;
            //resultHtml+='&lt;h2&gt;&lt;a href="#"&gt;'+item.title+'&lt;/a&gt;&lt;/h2&gt;';
            //resultHtml+='&lt;p&gt;'+item.post.replace(highlight, '&lt;span class="highlight"&gt;'+highlight+'&lt;/span&gt;')+'&lt;/p&gt;';
            //resultHtml+='&lt;a href="#" class="readMore"&gt;Read more..&lt;/a&gt;'
            resultHtml+='&lt;/div&gt;';
        });

        $('div#results').html(resultHtml);//resultHtml
    }
</code></pre>

<p>SEARCH php page:</p>

<pre><code>if(!empty($_POST['q'])) {
    search($_POST);
}

function search($post) {
 @mysql_connect ( DB_HOST, DB_USER, DB_PASSWORD ) or die ( 'Could Not Connect To MySQL' .mysql_error() );
 @mysql_select_db ( DB_NAME ) or die ( 'Could Not Select The Database' .mysql_error() );

 $q = mysql_real_escape_string($post['q']);
 echo $q;
 $sql = mysql_query("select * from isproducts WHERE tags LIKE '%".$q."%' OR title LIKE '%".$q."%'");

    //Create an array with the results
    $results=array();
    while($v = mysql_fetch_object($sql)){
        $results[] = array(
          'title'=&gt;$v-&gt;title,
          'category'=&gt;$v-&gt;category
        );
    }

echo $results;
</code></pre>
