views:

62

answers:

1

Stupid question, but does anyone know how to load google's jquery from an external script so it doesnt clunk up my header? In other words, I want to take the code below (probably starting at the google.load stuff and save it inside another file to include in my header. I want to keep my view source pretty :)

<script src="http://www.google.com/jsapi?key=MySeCretKeyHere" type="text/javascript"></script>
<script type="text/javascript">google.load("jquery", "1.4.0");google.load("jqueryui", "1.7.2");
    google.setOnLoadCallback(function(){ $(document).ready(function(){ 
//onload stuff goes here
});});
</script>
+3  A: 

Just as you say:

load.js:

google.load("jquery", "1.4.0");google.load("jqueryui", "1.7.2");
    google.setOnLoadCallback(function(){ $(document).ready(function(){ 
//onload stuff goes here
});});

html:

<script src="http://www.google.com/jsapi?key=MySeCretKeyHere" type="text/javascript"></script>
<script src="load.js" type="text/javascript"></script>
adam
+1, as I was typging...
Mark Schultheiss
I know, stupid question. Thanks Adam.
st4ck0v3rfl0w