Symfony 无法通过FOSJsRoutingBundle生成路由

Symfony 无法通过FOSJsRoutingBundle生成路由,symfony,symfony-2.3,Symfony,Symfony 2.3,我在我的一个小树枝模板中使用了一个AJAX调用$.AJAX,因为我需要调用一个URL,所以我使用了。阅读文档后,按照每个步骤在我的模板中编写以下代码: <script> $(function() { $("a.step").click(function() { var id = $(this).attr('id'); $.ajax({ type: 'GET', url: Routing.gene

我在我的一个小树枝模板中使用了一个AJAX调用$.AJAX,因为我需要调用一个URL,所以我使用了。阅读文档后,按照每个步骤在我的模板中编写以下代码:

<script>
$(function() {
    $("a.step").click(function() {
        var id = $(this).attr('id');

        $.ajax({
            type: 'GET',
            url: Routing.generate('category_subcategories', {parent_id: id}),
            dataType: "json",
            success: function(ev) {
                // here I build the next
            }
        });
    });
});
</script>
有什么问题吗

更新

PHP控制器上的路径如下所示:

/**
 * Get subcategories based on $parent_id parameter
 *
 * @Route("/category/subcategories/{category_id}", name="category_subcategories", options={"expose"=true})
 * @Method("GET")
 */
现在它会生成路由,但会导致另一个错误:

网络错误:找不到404-


为什么?

在中搜索exposedocumentation@cheesemacfly请参阅我的更新更改路由。生成'category_subcategories',{parent_id:id}到路由。生成'category_subcategories',{category_id:id}@实际上,我已经按照您的建议进行了更改,但仍然存在以下错误:NetworkError:404未找到-http://devserver/app_dev.php/category/subcategories/6 不知道为什么找不到路线
/**
 * Get subcategories based on $parent_id parameter
 *
 * @Route("/category/subcategories/{category_id}", name="category_subcategories", options={"expose"=true})
 * @Method("GET")
 */