【发布时间】:2014-12-08 14:01:09
【问题描述】:
每 5 秒调用一次控制器的 JavaScript 代码
$.post('{{path('nb_invitation')}}',
{data: '1'},
function(response){
if(response.code == 100 && response.success){
alert('yes');
}
}, "json");
代码:
我的通知Iv.html
{% block notificationIv -%}
// content
{% endblock %}
生根
nb_invitation:
path: /communaute/nb_invitation
defaults: { _controller: communauterBundle:notificationIv:nb_invitation }
控制器
public function nb_invitationAction(Request $request){
return $this->render('communauterBundle:notificationIv:notificationIv.html.twig');
}
index.html
{% block notificationIv -%}
{{ render(controller('communauterBundle:notificationIv:nb_invitation')) }}
{% endblock %}
【问题讨论】:
-
我看不到我的块中的变化 块没有得到新数据
-
这个 JavaScript 代码是在外部 .js(包含)还是内联在
标签: javascript php symfony twig