I am trying to insert JS files into a view, but they are inserted in the wrong order.
In my default.ctp I have this
$this->Html->script(array(
'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js',
'global'
), array('inline'=>false));
echo $this->fetch('script');
In my opinion, I have the following:
$this->Html->script('jquery.fancybox.pack', array('inline' => false));
But when I look at the source, it looks like this:
<script type="text/javascript" src="/js/jquery.fancybox.pack.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="/js/global.js">
This is obviously the wrong order, so the jQuery plugin does not work.
What am I doing wrong?
source
share