我正在尝试使用ajax和symfony从下拉列表获得结果;我按照提供的文档中提到的所有设置进行了操作。但我得到了 POST http://localhost/docCMS/web/app_dev.php/getclientaddress/13 500内部服务器错误
/**
* @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);
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
suntec_marcus_getclientaddress:
pattern: /getclientaddress/{param}
defaults: { _controller: SuntecMarcusAssignmentBundle:Default:getclientaddress }
options:
expose: true
$(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);
}
});
});