0

I have created one event listing page, I am trying to when I click any event from event list it will redirect to appropriate event detail page.

For your easy reference

I can able to done by using ajax method, but I am looking for magento way to done this.

I have a plan to collect appropriate event details by using event name and date, but I don't know how to pass the value using get or post in magento 2 when click event.

I hope I am clear, still need any additional notes please mention in comment.

Thanks

  • you want to pass some value from view.phtml to controller/block correct?? – Mohammad Mujassam May 4 '16 at 7:02
2

Why do you want to send the value only by get/post. you can use parameter method in to get the data as below:

In Action Controller or Block:

$value = $this->getRequest()->getParam('parameter');

Where 'parameter' you get from url as below:

http://localhost/frontname/controllerfolder/controllername/parameter/value/

if your value is not that sensitive then you can use above method, if you want use post method only then u need to use script or print all the link in form.

Hope this will help you..

  • Thanks dude, I have already done, but the difference between you and me is I have pass value like "http://url?parameter=value", When I follow your way its shows 404 not found, which is right way – Bilal Usean May 4 '16 at 9:48
  • its working, both way is possible to pass the value . I think your way is the right one it seems like magento way. – Bilal Usean May 4 '16 at 10:08

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.