I have custom admin page edittab.phtml in that page I have ajax call
function deleteOldLens(id)
{
var url = "<?php echo $this->getUrl('/customtabs/ajax/deletelens');?>";
new Ajax.Request(url, {
method:'post',
parameters: {
id: id
}
, requestHeaders: {Accept: 'application/json'},
onSuccess: function(transport) {
retjson = transport.responseText.evalJSON();
alert( retjson.resp );
}
});
}
and in module customtabs/controllers/ajaxController.php I have deletelensAction().This code gives me error like
http://localhost/optishop/index.php/admin/customtabs/ajax/key/c86e7acf7f7d45339bf50a7ab6efc4b2/?isAjax=true
404 Not found
I have also tried other solutions like
Mage::app()->getStore()->getUrl('*/ajax/deletelens');
Mage::app()->getUrl('customtabs/ajax/deletelens')
asked Dec 1, 2014 at 14:44
Sayali
1151 gold badge5 silver badges16 bronze badges
-
2Please try var url = "<?php echo $this->getUrl('customtabs/ajax/deletelens/');?>"; (note the removal of the first /)mbalparda– mbalparda2014年12月01日 14:46:13 +00:00Commented Dec 1, 2014 at 14:46
2 Answers 2
You should use
var url = "<?php echo
$this->getUrl('customtabs/ajax/deletelens/');?>";
Note the removal of the first /.
answered Dec 1, 2014 at 15:14
mbalparda
7,4033 gold badges24 silver badges46 bronze badges
You can get controller url by
$this->getUrl('YourModulefontName/ajax/deletelens');
answered Dec 1, 2014 at 14:46
default