2 deleted 153 characters in body
source | link

Initiate js in any.phtml file!

jQuery.ajax({
    url: "/package/module/index/getdata"
    type: "POST",
    data: {key: 'value'},
    success: function(response){
        console.log(response);
    }
});

Write controller app/code/local/Package/Module/controllers/IndexController.php

    Package_Module_IndexContoller extends Mage_Core_Controller_Front_Action{
        public function getdataAction(){
            if($data = $this->getRequest()->getPost("key")){
                echo "data received !";
            }else{
                echo "unable to receive data !";
            }
        }

    }

Please refer my blog for full info Call Magento controller using ajax

Initiate js in any.phtml file!

jQuery.ajax({
    url: "/package/module/index/getdata"
    type: "POST",
    data: {key: 'value'},
    success: function(response){
        console.log(response);
    }
});

Write controller app/code/local/Package/Module/controllers/IndexController.php

    Package_Module_IndexContoller extends Mage_Core_Controller_Front_Action{
        public function getdataAction(){
            if($data = $this->getRequest()->getPost("key")){
                echo "data received !";
            }else{
                echo "unable to receive data !";
            }
        }

    }

Please refer my blog for full info Call Magento controller using ajax

Initiate js in any.phtml file!

jQuery.ajax({
    url: "/package/module/index/getdata"
    type: "POST",
    data: {key: 'value'},
    success: function(response){
        console.log(response);
    }
});

Write controller app/code/local/Package/Module/controllers/IndexController.php

    Package_Module_IndexContoller extends Mage_Core_Controller_Front_Action{
        public function getdataAction(){
            if($data = $this->getRequest()->getPost("key")){
                echo "data received !";
            }else{
                echo "unable to receive data !";
            }
        }

    }
1
source | link

Initiate js in any.phtml file!

jQuery.ajax({
    url: "/package/module/index/getdata"
    type: "POST",
    data: {key: 'value'},
    success: function(response){
        console.log(response);
    }
});

Write controller app/code/local/Package/Module/controllers/IndexController.php

    Package_Module_IndexContoller extends Mage_Core_Controller_Front_Action{
        public function getdataAction(){
            if($data = $this->getRequest()->getPost("key")){
                echo "data received !";
            }else{
                echo "unable to receive data !";
            }
        }

    }

Please refer my blog for full info Call Magento controller using ajax