简体   繁体   中英

Jquery getScript($.getScript()) not working on chrome?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM