我路过AJAX GET参数,我的网址是这样的:的Symfony路由AJAX get方法
example.com/autocamplete?term=string
我补充路线为:
autocomplete:
path: /autocomplete?term={term}
defaults: { _controller: CatalogWebBundle:Default:autocomplete }
但有毛病我的路线,因为我得到错误:
GET http://127.0.0.1:8000/autocomplete?term=sdfsd 500 (Internal Server Error)
如何重写我的路由到ajax获取patameters?
JS是:
<script type="text/javascript">
$(function() {
//autocomplete
$("#search").autocomplete({
source: "\/autocomplete",
minLength: 1
});
});
</script>
我不使用树枝将无法正常工作,但使用PHP模板如何改写这个''to php? – Wizard 2014-11-25 14:39:15
@TomasLiachovskis看看[这个文档页](http://symfony.com/doc/current/cookbook/templating/PHP.html) – xurshid29 2014-11-25 16:30:39