php - Routing static urls in javascript files in symfony -
I have some javascript files in my java Symfonyt2
project that has some formula from the Javascript file Dynamically loaded for example:
$ ('. Records_list'). Datatelle ({"language": {"url": "../shared/js/datatables.persian.json"}});
URLs work in pages with ../shared / js / datatables.persian.json
URLs like / test
but This fails with the url Ic / test2 / action
in the pages.
How can I fix this?
What is the cssrewrite
filter for the addict? Can I make the route for such a URL?
If you do not have many such cases, you can use the Store your file path with a twist:
& lt; Div id = "file-store" style = "display: none;" Data-value = "{{property ('shared / js / persian.jason')}}" & gt; & Lt; / Div & gt;
and recover it in JS:
var shared file = $ ('# file-store'). Attr ('data-value'); $ ('. Record_list') Datatelle ({"language": {"url": shared file}});
If you have many such issues, you can use FOSJs routingbundle :
Comments
Post a Comment