如何将变量从javascript发送到控制器

时间:2015-02-12 13:41:49

标签: javascript html5 symfony controller twig

我正在使用symfony2,我需要将数据从javascript函数发送到控制器。

当网址中没有要发送的数据

时,此方法有效
document.location.href="{{path("modifMalade")}}"

但是我不知道如何把参数放在上面?

1 个答案:

答案 0 :(得分:0)

您只需阅读文档:

http://symfony.com/doc/current/reference/twig_reference.html#path

在您的情况下,它可能如下所示:

document.location.href="{{ path("modifMalade", {'param1': 'value1'})}}"
相关问题