title: CakePHP dynamic search with jQuery/AJAX
body: <p>currently I have a search that calls once a Controller Action with requestAction and returns a data array, then I use foreach to list in a table..
  So, how could I implant a button that refreshs the table without leave the page?</p>
  
  <p>thanks</p>
  
  <p>Edited:
  I have a element from a View called table.ctp, inside there is:
  <code>$products = $this-&gt;requestAction('/products/getAll');</code>
  then</p>
  
  <pre><code>foreach ($products as $product){
      echo $product['Product']['Name'];
  }
  </code></pre>
  
  <p>/\ render all my products that came from /products/getAll.</p>
  
  <p>Controller products, action getAll():</p>
  
  <pre><code>function getAll(){
      return $this-&gt;Product-&gt;getProducts();
  }
  </code></pre>
  
  <p>Model (Product.php), the function <code>getProducts()</code> returns <code>$this-&gt;find('all')</code></p>
  
  <p>I want to have an input in table.ctp that when I click a button, he will refresh the table with AJAX..
  I tried this: </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function(){
          $('#click').click(function(){
              $.ajax({
                  type: "POST",
                  url: '',  
                  success: function(data){
  
                  }
              });
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>but I have no idea how to proceed, which URL call, and this way is right..</p>
  
  <p>thanks!</p>