Hello friends developers,
I need an explanation regarding the interpretation of my php code in jquery.
this is my code in jquery using $_post
 var $this = $(this);
        e.preventDefault();
        $.post('/public/create_account', { data: $this.serialize()}, function (data) {
            if (data.reponse == "ok") {
                $('#signup').modal('hide');
                alert('it's ok');
            }
            else {
            $("#errors").html("<\?php  if (errors) : \?>"+
              '<div class="alert alert-danger alert-dismissable fade in">'+
              '<span style="font-size:16px;line-height:20px;font-weight: 700;"><i class="fa fa-exclamation-triangle"></i>' +
              ' Oops ! errors .</span>'+ 
              ' <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>'+
              ' <ul style="list-style:none;"><br>'+
              " <\?php  foreach (errors as error) : \?>"+
              ' <li>'+
              '  <span class="help-block" style="color:#a94442;"> <i class="fa fa-check"></i>  "<\?php  echo error ; \?>"</span>'+
              '   </li>'+
              "   <\?php  endforeach \?>"+
              ' </ul></div>'+
              "    <\?php  endif \?>")
            }
this is my code in php
  $validation = $this->validator->validate($request, [
        'civilité' =>                 v::notEmpty()->intVal()->between(1,2),
        'name' =>                     v::notEmpty()->alpha()->length(1,55),
        'email' =>                    v::notEmpty()->email()->ConfirmEmail(),
        'user_type' =>                v::notEmpty()->intVal()->between(1,2),
        'CodePostal'   =>             v::notEmpty()->intVal(),
        'ville'   =>                  v::notEmpty()->alpha(),
        'password' =>                 v::noWhitespace()->notEmpty()->length(6),
        'password_confirmation' =>    v::noWhitespace()->notEmpty()->ConfirmPassword($request->getParam('password')),
        'phone' =>                    v::notEmpty()->phone(),
        'term' =>                     v::notEmpty()->equals(1),
    ]);
  // failed
    if($validation->failed()){
       $reponse = 'ko';
       //return $response->withRedirect($this->router->pathFor('create_account'));
    }
    if($validation){
        $user = User::create([
                                    'pseudo' =>   htmlentities($request->getParam('name')),
                                    'email' =>     htmlentities($request->getParam('email')),
                                    'telephone' => htmlentities($request->getParam('phone')),
                                    'password' =>  htmlentities(password_hash($request->getParam('password'),PASSWORD_DEFAULT)),
                                    'navigateur' => $_SERVER['HTTP_USER_AGENT'],
                                    'ip' => $_SERVER['REMOTE_ADDR'],  
                                    'date_crea' => Carbon::now(),
                                    'civilite' => htmlentities($request->getParam('civilité')),  
                                    'user_type' => htmlentities($request->getParam('user_type')), 
                                    'code' => FunctionConfig::doGenerateCodeRandom(),
                                    'actif'=> 0,
                                    'codeuser' => FunctionConfig::doGenerateCodeUser()
                            ]);
        $reponse = 'ok';
     }
    echo json_encode(['reponse' => $reponse]);
When submitting my form fails, the php code is not interpreted. Why ??? this is the response in my DOM

 
    