I have created custom module for store credits, for this I have used ajax which are working at frontend but when calling adminhtml controller using ajax at admin it returns 404 not found error.
My config.xml is here :
<?xml version="1.0"?> <config> <modules> <Assel_Customajax> <version>0.9.0</version> </Assel_Customajax> </modules> ... <frontend> <routers> <checkout> <args> <modules> <Assel_Customajax before='Mage_Checkout'>Assel_Customajax_Checkout</Assel_Customajax> </modules> </args> </checkout> </routers> </frontend> <admin> <routers> <adminhtml> <args> <modules> <Assel_Customajax before="Mage_Adminhtml">Assel_Customajax_Adminhtml</Assel_Customajax> </modules> </args> </adminhtml> </routers> </admin> ... </config> Ajax for calling controller at admin
new Ajax.Request("<?php echo Mage::getUrl('assel_customajax/adminhtml_credits/usecredits') ?>", { method: 'post', onComplete: function(result) { ... } }); I have created function in customajax/controllers/adminhtml/creditscontroller :
public function usecreditsAction() { ... } But ajax return 404 not fount error. How to call controller function successfully?
adminhtmlhelper to generate admin urls, controller name should be camelcase. Check through everything, correct and you will probably find things to work.