我正在使用 Code Igniter 框架开发应用程序。我正在使用 Neatbean 8.2
作为我的编辑我的问题是我在我的网页上嵌入了 Javascript 代码,但它不起作用。我在我的 chrome 控制台上收到以下错误消息。
GET http://[::1]/william/puplic/js/bootstrap.js net::ERR_ABORTED 404 (Not Found)
index.php:9 GET http://[::1]/william/puplic/js/jquery.js net::ERR_ABORTED 404 index.php:10 GET http://[::1]/william/puplic/js/bootstrap.js net::ERR_ABORTED 404 (Not Found)[enter image description here][1]
index.php:72 Uncaught ReferenceError: $ is not defined
at index.php:72
$(function(){
alert(1);
});
[1]: /image/txQPI.png
<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Waboke Farms</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="<?= base_url()?>public/css/bootstrap.min.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?= base_url()?>public/css/style.css" media="screen" />
<script type="text/javascript" src="<?= base_url()?>puplic/js/jquery.js"></script>
<script type="text/javascript" src="<?= base_url()?>puplic/js/bootstrap.js"></script>
</head>
最佳答案
一个不错的技巧是从浏览器查看生成的 HTML(查看源代码)并通过单击链接检查您的 css 和 js 文件是否“可找到”...
但在你的情况下,我可以看到以下内容......
<link rel="stylesheet" type="text/css" href="<?= base_url()?>public/css/bootstrap.min.css" media="screen" />
<link rel="stylesheet" type="text/css" href="<?= base_url()?>public/css/style.css" media="screen" />
<script type="text/javascript" src="<?= base_url()?>puplic/js/jquery.js"></script>
<script type="text/javascript" src="<?= base_url()?>puplic/js/bootstrap.js"></script>
您的 css 文件位于 下公众 文件夹但您的 js 文件位于 下公众 文件夹。
那么这仅仅是一个错字吗?
关于javascript - 加载资源失败 : The server responded with a status of 404 (not found),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55883004/