title: how to set php array from the json ajax response
body: <p>List of category shows.After clicking the category , we have listed products based on category,when i clicked category,  get_category_products fucntion called, and return json output</p>
  
  <pre><code>[{"name":"watch","unit_price":"430.00"},{"name":"watch","unit_price":"250.00"}] 
  
  
  
  
  
  function get_category_products(category){
  
          $.ajax({
              type: 'POST',
              url:    "get_category_products.php",
              async: true,
              data: 'category=' + category,
              cache: false,
                  success: function(data)
                  {               
                  alert(data);                 
                  }
              });
  
      }
  </code></pre>
  
  <p>Products List code</p>
  
  <pre><code>&lt;div style="border:solid 1px red;width:230px;height:300px;overflow-y:scroll;"&gt;
          &lt;h4&gt;Items/Products&lt;/h4&gt;
          &lt;hr&gt;
          &lt;table border="0"&gt;  
  
           &lt;tr&gt;
               &lt;?php $count =1; 
               $countItems = count($products_list);
               for($pr1=0;$pr1 &lt; $countItems;$pr1++){  ?&gt;                     
                     &lt;td style="border:solid 1px black;width:100px;height:70px;text-align:center"&gt;
                      &lt;table&gt;
                          &lt;tr&gt;&lt;td colspan="2"&gt;&lt;img src=""&gt;&lt;/td&gt; &lt;/tr&gt;
                          &lt;tr&gt;
                              &lt;td&gt;&lt;?php echo $products_list[$pr1]-&gt;name;?&gt;&lt;/td&gt;
                              &lt;td&gt;&lt;?php echo $products_list[$pr1]-&gt;unit_price;?&gt;&lt;/td&gt;
                          &lt;/tr&gt;                    
                      &lt;/table&gt;
                  &lt;/td&gt;
                      &lt;?php if($count % 3 == 0) { ?&gt; &lt;/tr&gt;&lt;tr&gt;&lt;?php } ?&gt;
                  &lt;?php $count++; } ?&gt;
           &lt;/table&gt;
  
      &lt;/div&gt;
  </code></pre>
  
  <p>How to decode json output and set to php array($products_list),how to display the products based on category using above code.</p>