I'm pretty new to Symfony2 framework and still don't really understand how to include JQuery lib after reading the following documentation http://symfony.com/doc/current/cookbook/assetic/asset_management.html#dumping-asset-files
I've seen similar questions but none of them explain how everything work together? And why we need to dump assetic? Why including them in the template is not enough?
Basically, what I want to do is to put my JQuery lib under app/Resources/js/ Then in any of my Twig template inside any of my bundle I want to refer/include this JQuery lib to be able to write a JQuery script code. Do I need to modify my app/config/config.yml file?
Please provide me with an example along with your explanation. The following is what I've done so far (all the following are in one Twig template):
{% javascripts 'app/Resources/js/jquery-1.8.0.js' %}
<script type="text/javascript">
$(document).ready(function (){
$('a').click(function(event){
$('#box').fadeOut();
});
});
</script>
{% endjavascripts %}
<div id="box">
<a href="#">click me</a>
</div>
The page is loaded without any problems but when I click on 'click me' the JQuery code doesn't get executed!