title: posting array using ajax to the controller in cakePHP
body: <p>I am relatively new to cake and I am struggling with a custom filter that im making in order to display products based on which checkboxes have been ticked. The checkboxes get populated based on which attributes the user creates in the backend, i then collect all the values of the selected boxes into an array with javascript and post it to the controller, but for some reason I cannot access the controller variable named '$find_tags' in my view, it throughs undefined variable.
  Here is my javascript and ajax which collects and posts correctly (when i firebug it 'data' in my controller has array values which im posting) so thats fine</p>
  
  <pre><code>$("#clickme").click(function(event){    
      event.preventDefault();
      var searchIDs = $("#checkboxes input:checkbox:checked").map(function(){
          return $(this).val();
      }).get();
  
      var contentType = "application/x-www-form-urlencoded";
      var data = 'data[ID]='+searchIDs;
      $.post("",data,function(data){
          console.log(data);
      });
  
      });
  </code></pre>
  
  <p>Here is my controller code which im assuming is where the fault lies</p>
  
  <pre><code>if ($this-&gt;request-&gt;is('post') ) {
       $data = $this-&gt;request-&gt;data['ID'];
       $find_tags = array();   
       $selected_tags = $data;
       foreach($selected_tags as $tag)
       {
          array_push($find_tags,$this-&gt;Product-&gt;findByTag($tag));
          $this-&gt;set('find_tags', _($find_tags));
       }
    }
  </code></pre>
  
  <p>And here is my view code where i get Undefined variable: find_tags</p>
  
  <pre><code>foreach($find_tags as $all_tag)
    {
    echo $all_tag['Product']['name'];
    echo '&lt;/br&gt;';
    }
  </code></pre>
  
  <p>Any help or suggestions would really be appreciated been struggling with this for a while now</p>