admin管理员组

文章数量:1426620

I am developing an application with Code Igniter framework. I am using Neatbean 8.2 as my editor My issue is I am embedding Javascript code on my web page and it is not working. I am getting following error message on my chrome console.

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]: .png
 <!DOCTYPE html >
<html xmlns="">
<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>

I am developing an application with Code Igniter framework. I am using Neatbean 8.2 as my editor My issue is I am embedding Javascript code on my web page and it is not working. I am getting following error message on my chrome console.

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]: https://i.sstatic/txQPI.png
 <!DOCTYPE html >
<html xmlns="http://www.w3/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>

Share Improve this question edited May 2, 2019 at 13:01 Cœur 38.8k25 gold badges206 silver badges279 bronze badges asked Apr 27, 2019 at 17:14 William RupertWilliam Rupert 11 gold badge1 silver badge2 bronze badges 5
  • Please add some codes at least minimum code to represent issue so munity can help you. – Kamal Panhwar Commented Apr 27, 2019 at 17:20
  • Where the system is looking for the files doesn't seem to be the standard codeigniter tree system. Show us how you are including the JS file in your header/footer – Enoch Commented Apr 27, 2019 at 18:37
  • Thank you for responding to my question. – William Rupert Commented Apr 27, 2019 at 20:14
  • show us a picture of your file tree, particular where your js files are located. further, set your base_url – Alex Commented Apr 27, 2019 at 20:16
  • I try to send a picture of my file tree but could not. i have added part of my head html code for you to see. i created a folder call public where my bootsrap files are. the css is working fine but the javascrpt is given me error message. i think it is an ubuntu problem. although am not sure. – William Rupert Commented Apr 27, 2019 at 20:54
Add a ment  | 

1 Answer 1

Reset to default 1

One nice trick is to view your generated HTML ( View Source ) from your browser and check your css and js files are "findable" by clicking on the links...

But in your case, I can see the following...

<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>

Your css files live under the public folder BUT your js files live under the puplic folder.

So is this simply a Typo?

本文标签: javascriptFailed to load resources The server responded with a status of 404 (not found)Stack Overflow