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?
thanks
Edited:
I have a element from a View called table.ctp, inside there is:
$products = $this->requestAction('/products/getAll');
then
foreach ($products as $product){
echo $product['Product']['Name'];
}
/ender all my products that came from /products/getAll.
Controller products, action getAll():
function getAll(){
return $this->Product->getProducts();
}
Model (Product.php), the function getProducts()
returns $this->find('all')
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:
<script type="text/javascript">
$(document).ready(function(){
$('#click').click(function(){
$.ajax({
type: "POST",
url: '',
success: function(data){
}
});
});
});
</script>
but I have no idea how to proceed, which URL call, and this way is right..
thanks!