Php ot of(有时5个或更多)。为什么?firebug仍然没有在源代码中显示javascript。。。为什么?也许你应该试着在nextWeek和lastWeek按钮中使用ID而不是类。我还看到您正在使用日历类。你有多个日历吗?没有,所以我将所有这些都改为ID
Php ot of(有时5个或更多)。为什么?firebug仍然没有在源代码中显示javascript。。。为什么?也许你应该试着在nextWeek和lastWeek按钮中使用ID而不是类。我还看到您正在使用日历类。你有多个日历吗?没有,所以我将所有这些都改为ID,php,javascript,symfony,controller,twig,Php,Javascript,Symfony,Controller,Twig,ot of(有时5个或更多)。为什么?firebug仍然没有在源代码中显示javascript。。。为什么?也许你应该试着在nextWeek和lastWeek按钮中使用ID而不是类。我还看到您正在使用日历类。你有多个日历吗?没有,所以我将所有这些都改为ID。我修改我的控制器如下:$return=$this->renderView('CDUserBundle:Default:prof_calendrier.html.twig',array('next_cours'=>nextCours,'toda
ot of(有时5个或更多)。为什么?firebug仍然没有在源代码中显示javascript。。。为什么?也许你应该试着在nextWeek和lastWeek按钮中使用ID而不是类。我还看到您正在使用日历类。你有多个日历吗?没有,所以我将所有这些都改为ID。我修改我的控制器如下:
$return=$this->renderView('CDUserBundle:Default:prof_calendrier.html.twig',array('next_cours'=>nextCours,'today'=>date('D'),'nextWeek'=>nextWeek,'lastWeek'=>lastWeek,'datesWeek'=>datesWeek));返回新的响应($return,200,array('Content-Type'=>'text/html')代码>它以某种更好的方式工作。我只是遇到了一个问题,当我按下next/last week按钮时,我发现Firebug,JS没有发送一个ajax请求,而是发送了很多请求(比如有时发送5个或更多)。为什么?firebug仍然没有在源代码中显示javascript。。。为什么?也许你应该试着在nextWeek和lastWeek按钮中使用ID而不是类。我还看到您正在使用日历类。你有不止一个日历吗?没有,所以我把所有这些都改成ID。
<script type="text/javascript">
$('.nextWeek').live('click', function () {
$.ajax({
url: 'prof_calendrier/{{ nextWeek }}',
success: function (html) {$('.calendrier').html(html);}
});
});
$('.lastWeek').live('click',function () {
$.ajax({
url: 'prof_calendrier/{{ lastWeek }}',
success: function (html) {$('.calendrier').html(html);}
});
});
</script>
<p>Week from {{datesWeek.0}} to {{datesWeek.6}}</p>
[...] display rest of informations
public function prof_calendrierAction ($date) {
$erreur='';
$message='';
$session = $this->container->get('session');
[...] // lot of operations
return $this->render('CDUserBundle:Default:prof_calendrier.html.twig', array(
'next_cours' => $liste_prochains_cours,
'today' => date('D'),
'nextWeek' => $nextWeek,
'lastWeek' => $lastWeek,
'datesWeek' => $datesWeek
));
}
use Symfony\Component\HttpFoundation\Response;
return new Response($return,200,array('Content-Type'=>'application/json'));
<script>
var globalMonth = {{ month }}; // set up the starting month
...
$('#nextWeek').unbind();