I need to call a route with parameters from java script and I would like it to work independent of the URL format (enable URLs in path-format)
My problem is, in path format I need to append ‘?’ and in the other format ‘&’.
My current workaround is to use a dummy parameter as
$urlGetProfile = $this->createUrl('controller/getProfile', array('dummy' => 'param'));
so that javascript can do
var url = '$urlGetProfile' + '&name=' + studentName;
Is there a better solution?