I have a button that I'd like it to create an order :
<button id="" title="Create order" type="button" onclick="setLocation('<?php echo Mage::getUrl('ajax/index/createOrder') ?>')" >Create order</button>
This is the controller method, it's calling a function from the block :
public function createOrderAction()
{
$order = $this->getLayout()->getBlockSingleton('recentproducts/recentproducts')->createOrder();
return $order;
}
And the block is calling the business method from the model:
public function createOrder() {
$order = Mage::getModel('recentproducts/recentproducts')->createOrder();
return $order;
}
All is working fine, the order is created, but I don't like when pressing the button to be redirected to another page. I want to click on the button, it stays on the actual page, it created the order, and it gives me a confirmation message .