I am having a problem with what .getScriptworks in some odd cases.
For example, this works to load scripts only when necessary.
function twitterSDK() {
$jQ.getScript('http://platform.twitter.com/widgets.js');
}
function diggShare() {
$jQ.getScript('http://widgets.digg.com/buttons.js');
}
function buzzShare() {
$jQ.getScript('http://www.google.com/buzz/api/button.js');
}
However, it does not seem to work on several scripts that I wrote. If I call .getScriptto extract this JS file that I uploaded to Pastebin ( http://pastebin.com/GVFcMJ4P ), but the call tweetStream();does not happen. However, if I do the following, this works:
var twitter = document.createElement('script');
twitter.type = 'text/javascript';
twitter.async = true;
twitter.src = '/path-to/tweet.js';
$jQ('.twitter-section').append(twitter);
tweetStream();
What am I doing wrong? Any help would be awesome, thanks!
PS Which method is faster or more efficient?
. pastebin, .js, , , . ;)