There are two ways of passing data to the controller vi a link.
Option 1, is to use the query string mysite.com/something?value1=somevalue&value2=somevalue
Option 2, is with the url itself `mysite.com/something/somevalue/somevalue
If you handle the request with javascript then you can pass a json body to the controller.
@vannian Why not just pass the built URL to your JavaScript?
You can’t call PHP functions in JavaScript like you’re trying to. route is a PHP function. The PHP process has been and gone before a single line of JavaScript is executed in your browser.