symfony - Can't generate routes trough FOSJsRoutingBundle -
i'm using ajax call trough $.ajax()
in 1 of twig templates , because need call url i'm using fosjsroutingbundle. after read docs, follow every steps , write code in template:
<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 build next } }); }); }); </script>
i got error in firebug console:
referenceerror: routing not defined url: routing.generate('category_subcategories', {parent_id: id}),
what wrong there?
update
the route @ php controller one:
/** * subcategories based on $parent_id parameter * * @route("/category/subcategories/{category_id}", name="category_subcategories", options={"expose"=true}) * @method("get") */
now generate route cause other error:
"networkerror: 404 not found - http://my.url.domain/app_dev.php/category/subcategories?parent_id=6"
why?
Comments
Post a Comment