It sounds like it should be pretty simple, but it doesn't load so much.
I have this in mine app/views/layouts/application.html.haml:
= javascript_include_tag 'http://www.google.com/jsapi'
%script{ :type => "text/javascript", :charset => "utf-8" }
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.2");
= javascript_include_tag 'application'
... where my file application.jscontains some nice 'ole jQuery. I installed JRails and my jQuery works fine with local copies of libraries, but I want to use the ones from the Goolge API.
Here is what my browser generates:
<script src="http://www.google.com/jsapi.js" type="text/javascript"></script>
<script charset='utf-8' type='text/javascript'>
google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.2");
</script>
<script src="/javascripts/application.js?1255040651" type="text/javascript"></script>
I use Safari and the error console, which reports the following errors:
ReferenceError: Can't find variable: google
ReferenceError: Can't find variable: $
Accordingly, none of my jQuery scripts work.
reference
source
share