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

走远了吗. 提交于 2019-12-24 23:06:45

问题


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:


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.



来源:https://stackoverflow.com/questions/3448910/jquery-getscript-getscript-not-working-on-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!