I'm adding a script into my twig file, to redirect to other route.
<script>
$('#lnkPanel').click(function(e) {
e.preventDefault();
window.location = '{{ path('profile/' ~ user.id ~ '') }}';
});
But when my twig is rendering I get an error and this not show my page. Error is: "An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "profile/{1}" as such route does not exist.")"
How can I do to not get an error while is rendering twig, and show my page correctly??
Thanks!