ajax - updating student information in symfony -




i developping application , got problem in front-end part. it's related symfony , ajax. using session variable in order add student school before sending form of school server (back-end). using ajax. not how debug it. tried posted in net not work. able add student school not able update student information. that's seem easy it's not thought. here ajax call using in schoolcreate.html.twig:

function ajax () {         $.ajax({             type: 'post',             url: "{{ path('student_add') }}",             data: $('#addstudent').serialize(),             success: function (response) {                 var htmltodisplay = response.trim();                 $('#students').html(htmltodisplay);             }         });     } 

my modal used create school:

<div class="modal-body">         {{ render(controller('appbundle:school:addstudent')) }} </div> 

addstudent:

public function addstudentaction(request $request) {     $student = new student();     $form =  $this->createform(studenttype::class, $student);     $form->handlerequest($request);     $headers = array('accept' => 'application/json');      $encoders = array(new jsonencoder());     $normalizers = array(new objectnormalizer());     $serializer = new serializer($normalizers, $encoders);     if ($request->isxmlhttprequest())     {       $session = $request->getsession();       $student = $form->getdata();       if ($session->has('students'))           $students = $session->get('students');       $students[] = $student;       $session->set('$students', $students);       $template = $this->renderview('appbundle:school:studentlist.html.twig', array(             'students' => $students         ));         return new response($template);     }     return $this->render('appbundle:student:studentadd.html.twig', array(         'form' => $form->createview()     ));     } 

i try same in updatestudent function got problem related 30 second exceeded , not know how debug in ajax. define bottom of update inside studentlist.html.twig thanks,





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -