Symfony:EventSubscriber - 忽略JS路由

I have an EventSubscriber that checks the data before passing to the Action.

In this class, I use a method to verify if the requested route is the right route or not; this test is based on the value of a variable in the Session ($session['recordStatus']).

On this test, I want to exclude/ignore the JS routes used by AJAX functions (ex. record_detail_ajax).

This is what i've done, but without success !

class TokenSubscriber implements EventSubscriberInterface
{
   public function onKernelController(FilterControllerEvent $event)
   {
      $requestedRoute = $event->getRequest()->attributes->get('_route');
      if ( !preg_match( '/ajax/', $requestedRoute )) {

          // Another function that returns the right route according to the recordStatus
          $this->redirectionCheck = $this->checkRedirection( $sessionUid, $token );

          if ($requestedRoute != $this->redirectionCheck['route'] && !preg_match( '/ajax/', $requestedRoute )) {
              $event->setController( function () {
                   return new RedirectResponse( $this->redirectionCheck['redirection'] );
              } );
          }

      }
   }
}

I'm using FosJS for JS routing.

With this code, i always get this error :

Error: The route "record_detail_ajax" does not exist. router.js:243:27

getRoute http://my_app.com/bundles/fosjsrouting/js/router.js:243

generate http://my_app.com/bundles/fosjsrouting/js/router.js:266

http://my_app.com/assets/js/record/record.ajax.js:70 jQuery 2