2015-11-04 98 views
0

我是magento模塊開發的新手。我想從Magento的後端請求Ajax調用。這裏我做了模塊...以下是截圖 enter image description hereMagento模塊的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調用...任何幫助,將不勝感激

回答

1

創建您的控制器,你要調用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>

希望幫助

+0

問題是..我如何可以上傳到不同的項目...因爲JavaScript文件會從模塊目錄 –