Symfony 2,Ajax

I have big problem because i can't make AJAX request in Symfony.

I have some code in template

    $( document ).ready(function() {
    $( ".data" ).change(change_selected);
    });
     function change_selected(){
     $.ajax({
            type: "POST",
            url: "{{path('validate')}}",
            data: {'name' : 'kk'},
            cache: "false",
            dataType: "html",
            success: function(response) {
                alert('asd');
            }
    });
     }

and i made controller with function

/**
     * @Route("/validate_form", name="validate")
     * @Template()
     */
    public function ajaxeAction()
    {   

        if($request->isXmlHttpRequest()) {
             $response = new Response();
             $output = array('success' => true);
             $response->headers->set('Content-Type', 'application/json');
             $response->setContent(json_encode($output));
             return $response;
        }

    }

when i run firebug and change a text in the input field then firebug return error "500 Internal Server Error - ...test/web/app_dev.php/validate_form""

Someone know why ?

you didn't init function with Request $request?

public function ajaxeAction(Request $request){..}