title: MVC access multidimensional array on view and display values
body: <p>In my ajax function success part when I alert data , I can see data as <code>two dimensional array</code> but when I try to display <code>$jobs</code> data on view  i am not getting $jobs array ,why is that so , I also tried to send JSON format of array to access it but it didn't work .where is mistake ?</p>
  
  <p><strong>getting array as</strong></p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [id] =&gt; 1
              [jsp_title] =&gt; php developer job
          )
      [1] =&gt; Array
          (
              [id] =&gt; 2
              [jsp_title] =&gt; java developer job
          )
  ) 
  </code></pre>
  
  <p><strong>controller</strong></p>
  
  <pre><code>public function processjobsearch()
      { //print_r($_POST);
      try {       
              $valToSearch = isset($_POST['keyword']) ? trim($_POST['keyword']) : NULL;
              $datepicker = isset($_POST['datepicker']) ? trim($_POST['datepicker']) : NULL;
              $jobdate = strtotime($datepicker);
              $nature = isset($_POST['nature']) ? trim($_POST['nature']) : NULL;
              $location = isset($_POST['location']) ? trim($_POST['location']) : NULL;
             $jobs = $this-&gt;_model-&gt;getJobSearchData($valToSearch, $nature, $location, $jobdate);    
           //return  json_encode($jobs);
             $this-&gt;_view-&gt;set('jobs', $jobs);    
             return $this-&gt;_view-&gt;output();
  
          } catch (Exception $e) {
              echo '&lt;h1&gt;Application error:&lt;/h1&gt;' . $e-&gt;getMessage();
          }       
      }
  </code></pre>
  
  <p><strong>view</strong></p>
  
  <pre><code>&lt;script&gt;
          function jobsearch()
          {
               var form=$("#jobSearchForm")   
                 //$("#result").html("&lt;img alt="ajax search" src='ajax-loader.gif'/&gt;"); 
               $.ajax({
                      type: 'POST',
                      url: '/jobs/processjobsearch/',
                      data: form.serialize(),
                      success: function(data){
                           //alert(data);                  
                          $("#keyword").val("");              
                          }       
                  }); 
          }
  &lt;/script&gt;
      &lt;table border='solid'&gt;
      &lt;tr&gt;&lt;th&gt;Title&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
      &lt;?php print_r($jobs); ?&gt;
      &lt;?php  if ($jobs):
         foreach ($jobs as $row =&gt; $value): ?&gt;
      &lt;tr&gt;&lt;td&gt;&lt;?php echo $value['jsp_title']; ?&gt;&lt;/td&gt;&lt;td&gt;&lt;?php echo $value['jsp_desc']; ?&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;?php 
                                                                  endforeach;
                                                                  else: ?&gt;
  
                                                                      &lt;?php endif; ?&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p><strong>model</strong></p>
  
  <pre><code>public function getJobSearchData($valToSearch, $nature, $location, $jobdate)
       { 
       $sql = "SELECT
                       *
                      FROM
                       js_projects
                       WHERE ";
  
           if($valToSearch || $nature || $location || $jobdate)
         {
          $sql .= "jsp_title like '%$valToSearch%' OR jsp_nature like '%$nature%' OR jsp_location like '%$location%' OR jsp_date like '%$jobdate%' ";
         }    
           //echo $sql;                               
               $this-&gt;_setSql($sql);                
               $jobs = $this-&gt;getAll();
          print_r($jobs);
          if (empty($jobs))
              { 
                  return false;
              }       
          return $jobs;
       }  
  </code></pre>