Jquery getScript($.getScript()) not working on chr

2019-08-27 09:34发布

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?

1条回答
在下西门庆
2楼-- · 2019-08-27 10:04

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.

查看更多
登录 后发表回答