jQuery getScript($.getScript())在chrome上不起作用? [英] Jquery getScript($.getScript()) not working on chrome?

查看:323
本文介绍了jQuery getScript($.getScript())在chrome上不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在chrome上使用$.getScript()时遇到问题.在chrome浏览器上不起作用.我已经在Firefox(即Safari)上对其进行了测试,并且可以正常工作.我在外部脚本上所拥有的只是一个alert(),它不起作用.

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.

这是代码:

页面

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

script.js

alert('Get script loading');

有人遇到过这个问题吗?

Is anyone have experienced this problem?

推荐答案

感谢大家对我说清楚.

我想我应该将脚本内联,因为内联代码将在所有浏览器上正常工作.

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

这篇关于jQuery getScript($.getScript())在chrome上不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆