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

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -