[eluser]Tanvir[/eluser]
Hello, I m new to CI. I tried using jquery the following way-
My Controller-
Code:
<?php
class Blog extends CI_Controller{
public function __construct()
{ parent :: __construct() ;
$this->load->helper('url');
}
public function index()
{ }
public function ajaxShow(){
$this->load->view("ajaxDemo_view");
}
}
?>
My View file-
Code:
<html>
<head>
[removed][removed]
[removed] [removed]
</head>
<body><button id='show'> DISPLAY</button> <p>
</body></html>
ANd here is the javascript file- ajaxDemo.js
Code:
$(document).ready(function() {
alert ('Hello World');
});
I added
script type='text/javascript' src=' <?php base_url();?>assets/js/jquery-1.6.1.js'and script type='text/javascript' src=' <?php base_url();?>assets/js/ajaxDemo.js'> in head section of the view file (which is removed in here)
I used a javascript file -ajaxDemo.js to show a simple alert(). IF Jquery and js files are loaded from view file, then shouldnt it work this way ?