symfony2: including inline javascript -
symfony2: including inline javascript -
i've added javascript code below show photos using slide show jquery plugin.
//parent template {% block javascripts %} <script src="{{ asset('http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js') }}" type="text/javascript"></script> <script src="{{ asset('bundles/canalonesfrontend/js/slides.min.jquery.js') }}" type="text/javascript"></script> {% endblock %} //child template {% block javascripts %} {{ parent() }} $(function(){ $("#slides").slides(); }); {% endblock %}
the problem: code shown in web page directly:
some content $(function(){ $("#slides").slides(); });
you have wrap <script></script>
tag around code
//child template {% block javascripts %} {{ parent() }} <script type="text/javascript"> $(function(){ $("#slides").slides(); }); </script> {% endblock %}
i hope understood problem!
symfony2
Comments
Post a Comment