I'm inside the Admin area, I'm adding a check inside the products, inside my File phtml write:
<?php $ajaxUrl = Mage::helper('adminhtml')->getUrl('adminhtml/MyCompany_MyModule_AjaxController/check'); ?>
This is real path
\http\app\code\local\MyCompany\MyModule\controllers\ajaxController.php
This is the Function inside file phtml
function check(element) {
new Ajax.Request('<?php echo $ajaxUrl ; ?>', {
method: 'get',
onSuccess: function(transport) {
alert('Sent notification.');
},
onFailure: function(transport) {
alert("Couldn't send a notification. ");
console.log(transport);
}
});}
This is inside my controller:
public function checkAction()
{
$value= 'example';
Mage::app()->getResponse()->setBody($value);
}
and this is my config.xml
<admin>
<routers>
<adminhtml>
<args>
<modules>
<MyCompany_MyModule before="Mage_Adminhtml">MyCompany_MyModule</MyCompany_MyModule>
<MyCompany_MyModule after="Mage_Adminhtml">MyCompany_MyModule_Adminhtml</MyCompany_MyModule>
</modules>
</args>
</adminhtml>
</routers>
</admin>
Premise, the ajax call works but I always get 404 error back I'm pretty sure the paths are wrong, but I can not understand how to set them up, can you help me? thank you