Symfony How to pass javascript variables values from twig to controller Tip : var url = '{{ path("yourroute", {'id': 'id'}) }}'; url = url.replace("id", this.value); window.location.href = url;