I am new in Symfony2. I am trying to get result from a drop-down using ajax and symfony; I did all the settings as it is which is mentioned in the documentation provided. But I am getting POST http://localhost/docCMS/web/app_dev.php/getclientaddress/13 500 Internal Server Error
DefaultController.php
/**
* @Route("/getclientaddress/{id}", name="get_client_address", options={"expose"=true})
* @Template("SuntecMarcusAssignmentBundle:Default:getclientaddress.html.twig")
*/
public function getclientaddressAction($getclientaddress){
$client = $this->get_client_details($id);
routing.yml
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
suntec_marcus_getclientaddress:
pattern: /getclientaddress/{param}
defaults: { _controller: SuntecMarcusAssignmentBundle:Default:getclientaddress }
options:
expose: true
ajax
$(document).on('change', '#client', function (){
var client_id = $(this).val();
var getTeamsUrl = Routing.generate('get_client_address',{ id: client_id });
$.ajax({
type : "POST",
url : getTeamsUrl,
success : function(response){
alert(response);
},error : function(XMLHttpRequest, textStatus, errorThrown){
alert('Error : ' + errorThrown);
}
});
});