I have a page app/views/shared/_tcpsocket.html.erb
and am trying to include the following two javscripts:
<script src = 'http://localhost:8000/static/Orbited.js' content-type='application/x-javascript'></script>
and
<script src = 'http://localhost:8000/static/protocols/xmpp/xmpp.js' content-type='application/x-javascript'></script>
But neither of them are recognised. I have checked and the addresses are valid. How do I link to thes开发者_JS百科e files? Do I need a javascript_include_tag
? I always seem to struggle linking to external .js files.
Thanks.
Why are you putting spaces between the src
, =
and value for this attribute? Try not putting these spaces there and see what results. I believe that HTML is parsing each space-separated value as its own attribute.
Try to put this on the head.
<%= javascript_include_tag 'static/Orbited.js','static/protocols/xmpp/xmpp.js' %>
精彩评论