178
rated 0 times
[
180]
[
2]
/ answers: 1 / hits: 10235
/ 10 Years ago, thu, july 10, 2014, 12:00:00
I would like to know how to pass javascript variables values from twig to controller using href path in Symfony2. this is my code:
<html>
<head>
<script src=//code.jquery.com/jquery-1.11.1.min.js></script>
</head>
<body>
<script>
var a = hello;
var b = hi;
var c = $('<a href={{ path('ikproj_groupe_homepagegroupe1', {'id': a, 'num': b}) }}>send data</a>');
$('body').append(c);
</script>
</body>
</html>
The problem is that it displays this message: Variable a does not exist .
So, my question is: what is the correct code to do that?
More From » symfony