Php 如何在CodeIgniter2.x.x中使用jQuery?
在我的配置文件中,我有$config['jquery']='js/jquery.js' 我的jquery.js文件位于应用程序文件夹之外,位于js文件夹内 我的控制器里有Php 如何在CodeIgniter2.x.x中使用jQuery?,php,javascript,jquery,codeigniter,Php,Javascript,Jquery,Codeigniter,在我的配置文件中,我有$config['jquery']='js/jquery.js' 我的jquery.js文件位于应用程序文件夹之外,位于js文件夹内 我的控制器里有 public $jquery public function __construct(){ $this->jquery = $this->config->item('jquery'); } public function index(){ $data['jquery'] = $this->j
public $jquery
public function __construct(){
$this->jquery = $this->config->item('jquery');
}
public function index(){
$data['jquery'] = $this->jquery;
$this->load->view('site_view',$data);
}
在我的视图文件中,我有
<script type="text/javascript" src='<?php echo "$base/$jquery" ;?>'></script>
有人知道发生了什么吗?
在其他框架中,包括jquery,我从来没有遇到过任何问题。看看你的源代码
您使用的是绝对路径而不是有效的http://path
请注意,这假设您的设置如下所示
/
/应用
/系统
/Css
/js
/index.php
/.htaccess
如果没有更多的话,很难回答。查看源代码并告诉我们输出的确切路径。您是否可以使用firebug检查jquery和这个externajs.js文件是否确实存在于html中。这就是查看源代码的方式忽略http后的空格
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)