Created
March 19, 2012 16:30
-
-
Save havvg/2118274 to your computer and use it in GitHub Desktop.
Symfony2 Twig JSON with JSONP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set jsonp = app.request.query.get('callback') %} | |
{% if jsonp %}{{ jsonp }}({% endif %} | |
{% block data %}{% if is_json|default(false) %}{{ data|raw }}{% else %}{{ data|json_encode|raw }}{% endif %}{% endblock %} | |
{% if jsonp %});{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment