0

I am developing a new module for my company in **Magento 2** and i require an AJAX Http post request, however I cannot find the correct URL.

I have all of my controllers currently set up however, when I send the request in JQuery I receive a 404 error.

File structure:

->Controller

---->Post

--------->Message.php

--------->User.php

---->Get

--------->Threads.php

--------->Messages.php

For example, if i am trying to send a request to Post/Message.php, What would the correct URL be?

Thanks.

  • are you working for magento-1 or magento 2? – Dhiren Vasoya Jan 16 '18 at 9:21
  • Magento 2, sorry I will update it now – user61783 Jan 16 '18 at 9:29
  • I post the answer, please check – Dhiren Vasoya Jan 16 '18 at 9:37
0

Here are the correct path of your above things.

  1. Magento_domain/extension_frontend_router/post/message

  2. Magento_domain/extension_frontend_router/post/user

  3. Magento_domain/extension_frontend_router/get/threads

  4. Magento_domain/extension_frontend_router/get/messages

  • hi Dhiren, In my frontend/routes.xml file, the front name is "forum". does this mean that the url i want to hit is www.mywebsite.com/forum/post/message? because this is the one showing a 404 – user61783 Jan 16 '18 at 9:43
  • yes "www.mywebsite.com/forum/post/message" right URL if everything implement properly. – Dhiren Vasoya Jan 16 '18 at 9:46
  • 1
    If my answer help you, please accept so it will help other in community. – Dhiren Vasoya Jan 16 '18 at 10:04
  • this does not seem to be working for me, I have been testing it for a while and cannot make it work – user61783 Jan 16 '18 at 11:51
  • First check have implement all the things proper? – Dhiren Vasoya Jan 16 '18 at 12:48

Your Answer

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