Welcome Guest, Not a member yet? Register   Sign In
JQUERY AJAX NOT WORKING
#1

[eluser]Tanvir[/eluser]
Hi I m new to CI. I cant get a simple jquery ajax to work. Heres my code-

This is my controller blog.php
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");
    }
}
?>
this is my View -ajaxDemo_view.php
Code:
<html>
<head>
[removed] [removed]
[removed] [removed]
</head>
<body>
<button id='btn'> SHOW AJAX</button> <p>
<div id='divAjax'> AJAX TEXT HERE </div>
&lt;/body&gt;
&lt;/html&gt;
this is js file ajaxDemo.js
Code:
$(function() {
  $("#btn").click( function(){
    $("#divAjax").load("/ci/assets/js/test.php");
});
});




Theme © iAndrew 2016 - Forum software by © MyBB