How to Generate Routing URLs in JavaScript
==========================================
If you're in a Twig template, you can use the same ``path()`` function to set JavaScript
variables. The ``escape()`` function helps escape any non-JavaScript-safe values:
.. code-block:: html+twig
But if you *actually* need to generate routes in pure JavaScript, consider using
the `FOSJsRoutingBundle`_. It makes the following possible:
.. code-block:: html+twig
.. _`FOSJsRoutingBundle`: https://github.com/FriendsOfSymfony/FOSJsRoutingBundle