How to make a ajax request to route and get its response?
Created 5 years ago by dilusha100

I create messaging app and I need to mark messages read without reloading the page. But when I make a ajax request to the route, it nothing happens but returning the html code of the welcome page. So, is there any way to make a ajax request using jquery or any related library?

ryanthompson  —  5 years ago

Have you routed the controller for this? Maybe share a little code (controller, route, etc) if you can.

ryanthompson  —  5 years ago

Or you could use the API module but it's PRO.

finnito  —  5 years ago

I'm not sure if it's a bit overkill, but you could definitely follow @ryanthompson's guide on making a custom Ajax form ( and then just embed a bunch of tiny forms with a hidden input that contains the id(?) of the comment that you are trying to mark as read.