JQuery does not seem to work in my Symfony2 project.
I use these 2 snippets to test JQuery in a twig html file and none of them is working:
{% block myJavascript %}
<script type="text/javascript">
if (typeof jQuery != 'undefined') {
alert('hi'); }
$(document).ready(function() {
alert('hi');
});
</script>
{% endblock %}
This code alone is working meaning that Javascript is working
alert('hi');
I have in my app/resources/view/base.html.twig
<link rel="javascript" href="{{ asset('bundles/etiennepsav/js/jquery-1.8.3.js') }}" type="text/javascript" media="all" />
Referring to the jQuery files located in :
app/src/Etienne/Bundle/PsavBundle/Resources/Public/js/jquery-1.8.3.js
Any ideas what's wrong? Is there a special config to set?