Dies ist der Inhalt meiner .../template/exportdb/attributes.phtml
Datei:
<span id = "attributes">Generate</span>
<script type="text/javascript">
jQuery(function () {
jQuery("#attributes").click(function(){
jQuery.ajax({
url: "<?php echo $this->getUrl('adminhtml/attributes/ajax'); ?>"
}).done(function() {
alert("Hey");
});
});
});
</script>
Dies ist meine Controller-Datei:
<?php
class Attin_Exportdb_Adminhtml_AttributesController extends Mage_Adminhtml_Controller_Action{
public function IndexAction() {
$this->loadLayout();
$this->getLayout()->getBlock("head")->setTitle($this->__("Export Attributes"));
//$this->getLayout()->createBlock('exportdb/adminhtml_attributes');
//$this->getLayout()->getBlock("exportdb/adminhtml_attributes");
$block = $this->getLayout()->createBlock('Mage_Core_Block_Template','attributes_exp_db',array('template' => 'exportdb/attributes.phtml'));
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
public function AjaxAction(){
echo "ajax";
}
}
Dies ist der config.xml
Inhalt:
<?xml version="1.0"?>
<config>
<modules>
<Attin_Exportdb>
<version>0.1.0</version>
</Attin_Exportdb>
</modules>
<global>
<helpers>
<exportdb>
<class>Attin_Exportdb_Helper</class>
</exportdb>
</helpers>
<blocks>
<exportdb>
<class>Attin_Exportdb_Block</class>
</exportdb>
</blocks>
</global>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<attin_exportdb before="Mage_Adminhtml">Attin_Exportdb_Adminhtml</attin_exportdb>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
Aber der Firebug zeigt mir den 404 , ich kann nicht Attibutes_ajaxAction
funktionieren. Warum?
Das Ergebnis: