来自模块的 Magento Ajax

Magento Ajax from Module

我是 magento 模块开发的新手。我想从 magento 后端请求 ajax 调用。我在这里制作了模块...这是屏幕截图

我有这样的字段:

<tpropay translate="label" module="tpropay">
                <label>Tpro3</label>
                <sort_order>670</sort_order>
                <show_in_default>1</show_in_default>
                <show_in_website>1</show_in_website>
                <show_in_store>0</show_in_store>
                <comment><![CDATA[ 
                <button class="scalable" onclick="return check(); ">Sync Products Now</button>  ]]></comment>

<fields>
 <active translate="label">
   <label>Enabled</label>
   <frontend_type>select</frontend_type>
   <source_model>adminhtml/system_config_source_yesno</source_model>
   <sort_order>1</sort_order>
   <show_in_default>1</show_in_default>
   <show_in_website>1</show_in_website>
   <show_in_store>0</show_in_store>
 </active>
</fields>
</tpropay>

现在我想要 ajax 在用户点击按钮时调用?对如何包含 javascript 和发送 ajax 呼叫感到困惑...任何帮助将不胜感激

创建您要调用的控制器 ajax,然后将您的 JavaScript 放入一个文件中,然后按布局 xml 添加该 js 文件,如下所示

<adminhtml_system_config_edit> <reference name="head"> <action method="addJs"><script>folder/ajax.js</script></action> </reference> </adminhtml_system_config_edit>

希望对您有所帮助