第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我的控制器中的 JS 變量問題

我的控制器中的 JS 變量問題

UYOU 2021-06-23 17:08:06
在我的 symfony (v3.4) 項目中,我需要將一些 javascript 變量從我的視圖傳遞給我的控制器:我使用 Jquery 和 Ajax 將我的變量發(fā)送到控制器,但我無法訪問我的變量。我的 Ajax 請求沒有問題,我通過 Symfony 分析器進行了檢查,請求已正確發(fā)送,但由于某種原因,控制器甚至無法檢測到 Ajax 請求。這是我的控制器:public function saisieAction(Request $request)    {        $user = $this->getUser();        $thisyear = date("Y");        $em = $this->getDoctrine()->getManager();        // Create the form        $form = $this->get('form.factory')->createBuilder(FormType::class)            ->add('ndf', CollectionType::class, array(                'entry_type' => NoteDeFraisType::class,                'label' => false,                'allow_add' => true,                'allow_delete' => true,            ))            ->getForm();        // if the form has been submited        if ($request->isMethod('POST') && $form->handleRequest($request)->isValid()) {            if($request->isXMLHttpRequest()){                //After some code debuging, this is never                 //executed                $month = $request->get('month');                $year = $request->get('year');                $sub_date = $month .'/' .$year;            }            $notesDeFrais = $form['ndf']->getData();            foreach ($notesDeFrais as $ndf) {                $ndf->setUser($user);                $ndf->setMonth($sub_date);                $em->persist($ndf);            }            $em->flush();        }        return $this->render('AvPlatformBundle:Platform:saisie.html.twig',            array(                'year' => $thisyear,  'form' => $form->createView()            ));    }我的 saisie.html.twig 視圖中的腳本:$(".month").click(function() {     var click = $(this);     var month = click.val();     var year = $("#years").val();      $.post("{{ path('avaliance_platform_saisie') }}",            { 'month' : month,              'year' : year            },            function (data,status) {                alert('Data sent');            });                    });
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 165 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號