Welcome Guest, Not a member yet? Register   Sign In
CI AND JQUERY
#1

[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>
&lt;body&gt;&lt;button id='show'> DISPLAY</button> <p>
&lt;/body&gt;&lt;/html>
ANd here is the javascript file- ajaxDemo.js
Code:
$(document).ready(function() {
  alert ('Hello World');
});
I added script type='text/javascript' src=' &lt;?php base_url();?&gt;assets/js/jquery-1.6.1.js'and script type='text/javascript' src=' &lt;?php base_url();?&gt;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 ?




Theme © iAndrew 2016 - Forum software by © MyBB