0

I have a problem using $.getScript() on chrome. It doesn't work on chrome browser. I've tested it on firefox, ie and safari and it worked. All I have on my external script is an alert() and it doesn't work.

Here's the code:

page

$(document).ready(function(){
  $("#btnGet").click(function(){
   $.getScript("script.js");
  });
});

script.js

alert('Get script loading');

Is anyone have experienced this problem?

Alexander
  • 23,432
  • 11
  • 63
  • 73
mr.b
  • 2,708
  • 8
  • 39
  • 64
  • on my html is this $(document).ready(function(){ $("#btnGet").click(function(){ $.getScript("script.js"); }); }); on script.js is only this alert('Get script loading'); – mr.b Aug 10 '10 at 12:39
  • 1
    Code would help. It would also help if you could describe where your page and your script are. If they're local, then you're running into a problem I just stumbled on over the weekend, which Nick Craver was good enough to help with: http://stackoverflow.com/questions/3430638/accessing-relative-urls-via-ajax-from-file-content – Pointy Aug 10 '10 at 12:40
  • Yes, it is local. So, is there any work around? I can't believe the chromium team is doing that. – mr.b Aug 10 '10 at 12:43
  • yes, the workaround is in the post @pointy links to. – Mike Sherov Aug 10 '10 at 12:49

1 Answers1

0

Thanks guys for making it clear to me.

I think I would have my script inline instead since the inline code will work fine on all browsers.

Alexander
  • 23,432
  • 11
  • 63
  • 73
mr.b
  • 2,708
  • 8
  • 39
  • 64