0
我想呈現一個控制器上的按鈕,當點擊返回一個HTML我用這個JavaScript方法如何用樹枝JavaScript方法渲染方法
function getPopoverContent(input) {
return {{ render(controller("LeymaxReserveBundle:Reserve:showAddReserveModal",{'iduser': user.id,'token':'1238','idreserve':'0'})) }};
}
但它會導致一個非法的異常,並與報價相同的事情: :
return "{{ render(controller("LeymaxReserveBundle:Reserve:showAddReserveModal",{'iduser': user.id,'token':'1238','idreserve':'0'})) }}";
這裏是我的acion ::
public function showAddReserveModalAction($iduser, $token, $idreserve) {
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository('LeymaxContactBundle:User')->find($iduser);
return $this->render('LeymaxReserveBundle:Reserve:addReserveModal.html.twig', array(
'user' => $user,
'token' => $token,
));
}
怎麼能行呢?
你試圖使用原始管道的樹枝體現在哪裏? 例如 return「{{render(controller(」LeymaxReserveBundle:Reserve:showAddReserveModal「,{'iduser':user.id,'token':'1238','idreserve':'0'}))| raw}}」; – Rooneyl
soory但它也返回一個迴歸異常,謝謝你的幫助,但它不起作用。 – user2784013
異常::未捕獲的SyntaxError:意外的令牌ILLEGAL – user2784013