admin管理员组文章数量:1429482
I am new to codeigniter and i am facing some issue. I have created a store locator by using core php.It's working perfectly.But i want to embed the code in codeigniter.I copied the files and when i try to run it's not displaying and showing following errors in console.
GET http://xxx/application/views/webpages/storeLocator/storelocator.js net::ERR_ABORTED 403 (Forbidden)
GET http://xxx/application/views/webpages/libs/handlebars.min.js net::ERR_ABORTED 403 (Forbidden)
For your reference: i have taken the code from /
I added the following script path in header.php
<script src="<?php echo base_url();?>application/views/webpages/libs/handlebars.min.js"></script>
<script src=";></script>
<script src="<?= base_url();?>application/views/webpages/storeLocator/storelocator.js"></script>```
NB:base_url is correct, because it's working for others.Anyone please help me . I tried different things last couple of days.
I am new to codeigniter and i am facing some issue. I have created a store locator by using core php.It's working perfectly.But i want to embed the code in codeigniter.I copied the files and when i try to run it's not displaying and showing following errors in console.
GET http://xxx/application/views/webpages/storeLocator/storelocator.js net::ERR_ABORTED 403 (Forbidden)
GET http://xxx/application/views/webpages/libs/handlebars.min.js net::ERR_ABORTED 403 (Forbidden)
For your reference: i have taken the code from https://www.softaox.info/jquery-store-locator-google-map-with-country-state-city-dropdown/
I added the following script path in header.php
<script src="<?php echo base_url();?>application/views/webpages/libs/handlebars.min.js"></script>
<script src="https://maps.google./maps/api/js?key=xxxxx"></script>
<script src="<?= base_url();?>application/views/webpages/storeLocator/storelocator.js"></script>```
NB:base_url is correct, because it's working for others.Anyone please help me . I tried different things last couple of days.
Share
Improve this question
edited Oct 30, 2020 at 5:38
ajo
asked Oct 30, 2020 at 4:54
ajoajo
151 gold badge2 silver badges7 bronze badges
2
- Might be permissions on that file, try and change the chmod and check chown too. – marcogmonteiro Commented Oct 30, 2020 at 9:12
- 1 No not working.Is there any way to redirect it to act like normal php codes?(like third party) @marcogmonteiro – ajo Commented Oct 30, 2020 at 10:31
1 Answer
Reset to default 0You are storing your javascript inside your views folder. The views folder should only have your view files.
For assets like images, css and javascript you should create a folder in your root directory like public with the following structure:
application
system
public
- css
- js
- img
Then in your views you load your javascript files with base url like this:
<script src="<?php echo base_url('public/js/libs/handlebars.min.js') ?>"></script>
All your files inside your application folder shouldn't be directly accessible. You only access your index.php outside said folder and let it do its magic.
Public files should be outside the application and system folders. Always.
本文标签: javascriptnetERRABORTED 403 (Forbidden) error in codeigniter when using store locatorStack Overflow
版权声明:本文标题:javascript - net::ERR_ABORTED 403 (Forbidden) error in codeigniter when using store locator - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745441605a2658472.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论