javascript - net::ERR_FILE_NOT_FOUND:在 PhpStorm 服务器上工作但在浏览器中不工作

标签 javascript html phpstorm

我正在测试一个 html 网页,但在浏览器中它无法正常工作。无法加载:

src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"

这是错误:

GET file://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js net::ERR_FILE_NOT_FOUND

我想询问同一 html 网页中的另一个错误,如下所示:

Uncaught ReferenceError: $ is not defined at files.html:337

这是脚本:

$('.toggle').click(function (e) {
e.preventDefault();
var $this = $(this);
if ($this.next().hasClass('show')) {
    $this.next().removeClass('show');
    $this.next().slideUp(350);
} else {
    $this.parent().parent().find('li .inner').removeClass('show');
    $this.parent().parent().find('li .inner').slideUp(350);
    $this.next().toggleClass('show');
    $this.next().slideToggle(350);
}
});

最佳答案

而不是
src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"
使用
src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"

关于javascript - net::ERR_FILE_NOT_FOUND:在 PhpStorm 服务器上工作但在浏览器中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55517470/

相关文章:

javascript - 如何将组件绑定(bind)到动态外部状态?

javascript - Electron - Node.js - fs.readFileSync 在构建 Electron 并在 Program Files 中时需要管理员权限

phpstorm - 如何在 PHPStorm 中关闭滚动条上的工具提示

javascript - Elasticsearch : How can i map json data having dynamic number of fields

javascript - 使用jquery查找特定的td并将值分配给文本输入

html - child 不向 parent 拉伸(stretch)

html - 设置图像的宽度/高度以避免图像加载时回流

php - 页眉不跨越整个页面

postgresql - PhpStorm 说 PostgreSQL 数据库不存在?

phpstorm - 如何使 PhpStorm/WebStorm 范围突出显示看起来更具表现力?