I want to pass three parameter to a PHP file with twig path()
. I found a solution in this question.
It works fine with one value, but with two values it puts &
instead of &
in the URL. this is the code I used:
var route = "{{ path('dashboardTable', { 'data1': 'fistData', 'data2' : 'secondData})}}";
route = route.replace('firstData', D1);
route = route.replace('secondData', D2 );
window.location.href = route;
It sets the firstData
and socondData
and the URL will be this:
http://localhost:8000/dashboard/table?data1=Low&data2=deactive
but because of the &
it's not working.
how can I change &
to &
?
the funny point is that if I put the amp;
before data2
in my get request like below, it works fine!
$data2 = $_GET["amp;data2];