Jquery 无法在codeigniter视图中加载外部javascript文件
我有以下目录结构Jquery 无法在codeigniter视图中加载外部javascript文件,jquery,codeigniter,include,Jquery,Codeigniter,Include,我有以下目录结构 *application *media *system 我将js文件放在media/js文件夹中,但当我尝试在视图中包含js文件时 <script type="text/javascript" src="media/js/common_functions.js"></script> 而且它不会加载js文件。。甚至jquery文件。。请问问题出在哪里。我可能做错了什么?试试这个: <script type="text/javascript" sr
*application
*media
*system
我将js文件放在media/js文件夹中,但当我尝试在视图中包含js文件时
<script type="text/javascript" src="media/js/common_functions.js"></script>
而且它不会加载js文件。。甚至jquery文件。。请问问题出在哪里。我可能做错了什么?试试这个:
<script type="text/javascript" src="../../media/js/common_functions.js"></script>
$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/';
试试这个:
<script type="text/javascript" src="../../media/js/common_functions.js"></script>
$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/';
试试这个:
<script type="text/javascript" src="../../media/js/common_functions.js"></script>
$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/';
要在控制器构造函数中手动初始化jQuery类,请使用$this->load->library
函数:
试试这个:
<script type="text/javascript" src="../../media/js/common_functions.js"></script>
$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/';
要在控制器构造函数中手动初始化jQuery类,请使用$this->load->library
函数:
对于标准且有用的方法,请尝试以下方法:
<script type="text/javascript" src="<?=base_url()?>media/js/common_functions.js"></script>
要了解标准且有用的方法,请尝试以下方法:
<script type="text/javascript" src="<?=base_url()?>media/js/common_functions.js"></script>
该死的地狱。。!
在这上面浪费了半个小时。我使用删除index.php。
现在我把我的东西放在根文件夹的public目录中,带有.htaccess文件,如下所示
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond $1 !^(index\.php|**public**|robots\.txt)
所以只要确保文件夹包含在重写条件$1中。。。行如下
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond $1 !^(index\.php|**public**|robots\.txt)
希望这能帮助别人。该死的。。!
在这上面浪费了半个小时。我使用删除index.php。
现在我把我的东西放在根文件夹的public目录中,带有.htaccess文件,如下所示
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond $1 !^(index\.php|**public**|robots\.txt)
所以只要确保文件夹包含在重写条件$1中。。。行如下
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond $1 !^(index\.php|**public**|robots\.txt)
希望这对其他人有所帮助。您将脚本
带视图的代码放在哪里?它位于应用程序/views folderi.e中,位于应用程序/views中的视图文件中。此:
问题不在路径中。脚本
带视图的代码放在哪里?它位于应用程序/views folderi.e中,位于视图文件中application/viewsry this:
问题不在路径中。实际上,如果我给出绝对路径,它确实可以正常工作。。谢谢你的帮助!!干杯:)事实上,如果我给出绝对路径,它确实可以很好地工作。。谢谢你的帮助!!干杯:)