2013-12-15 22 views

回答

1

按照步驟 -

1)創建模塊由Magento模塊creater。或者只需從您的phtml文件按鈕操作調用下面的ajax即可。

2)寫InexController.php文件中的控制器動作。

public function saveContactDetailsAction() { 
    //get details 
    $postData = $this->getRequest()->getParam('data'); 
    //save data...... 
    return "sucess" 
    } 

3)在你的phtml文件中寫入ajax代碼。

var reloadurl = '<?php echo $this->getUrl('module/index/saveContactDetails'); ?> '; 
    new Ajax.Request(reloadurl, { 
     method: 'POST', 
     parameters:id='paramater list with &', 

     onComplete: function(transport) 
     { //write sucess code here }, 
     onFailure: function() 
     { 
      //write error code here 
     }}); 

希望這有助於