0

I want to call a method defined in controller using AJAX from my custom module's block folder .php file.

how I can do that.?

  • Can you tell is exactly what you want to achieve? You initiate an AJAX/XHR request from the front-end using Javascript, not in a .php file. If you tell us something more about your end game we can probably help you better. – Marco de Vries Dec 6 '14 at 13:52
  • Thanks for reply @Marco , please refer this URL "magento.stackexchange.com/questions/46549/…" – Shashank Kumrawat Dec 6 '14 at 13:57
2

Magento uses PrototypeJS for Ajax, please refer to the documentation:

http://api.prototypejs.org/ajax/Ajax/Updater/ if you want to display the response as HTML inside an existing element.

http://api.prototypejs.org/ajax/Ajax/Request/ for any other kind of Ajax request

You get the URL to your controller as usual with $this->getUrl('module/controller/action')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.