views:

767

answers:

2

Tried this:

$('.link').click(function(e) {
 $.getScript('http://www.google.com/uds/api?file=uds.js&v=1.0', function() {        
  $('body').append('<p>GOOGLE API (UDS) is loaded</p>');
 });
 return false;
});

Yes, it loads a primary "uds.js" file and then locks page by loading a locale JS file ("default+en.I.js", see line #48 in "uds.js").

workaround (@jsbin)

+2  A: 

If you want to dynamically load google's libraries, you should check out google's autoloader: http://code.google.com/apis/ajax/documentation/#AutoLoading

It works quite nicely, but be careful if you use the autoloader wizard.

http://code.google.com/apis/ajax/documentation/autoloader-wizard.html

there's a bug for the c&p code that tripped me up: http://code.google.com/p/google-ajax-apis/issues/detail?id=244

Also I found that for some of google's libraries, if I try to asynchronously load scripts (like yours) that if I don't specify some of the optional parameters (language, callback, etc. -- even with an empty string), I'll see the behavior that you're seeing.

Edit: went ahead and tested it. Your solution here: http://pastie.org/486925

Keith Bentrup
A: 

Thank you keith, your solution saved me some big big headache!

nico