Welcome Guest, Not a member yet? Register   Sign In
Jquery ajax and CI not working
#1

[eluser]Edgars[/eluser]
My controller
Code:
class main extends Controller {
function __construct()
       {
            parent::Controller();
                $this->load->helper('url');
       }
    
    function index () {    
    $this->load->view('header');
    $this->load->view('home');
    }
    
    function doajax () {    
    echo "asd";    
    }
    }
Javascript
Code:
$(document).ready(function(){

$('#send').click(function() {

$.ajax({
   type: "POST",
   url: "/main/doajax",
   success: function(data){
     alert(data);
                          }
    });
});
});

It can't be any simpler and still not working.

I added this to constants.php config file. Do I need it anyway?
Code:
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');


Messages In This Thread
Jquery ajax and CI not working - by El Forum - 11-25-2010, 10:15 AM
Jquery ajax and CI not working - by El Forum - 11-25-2010, 12:20 PM
Jquery ajax and CI not working - by El Forum - 11-25-2010, 02:25 PM
Jquery ajax and CI not working - by El Forum - 11-25-2010, 02:55 PM
Jquery ajax and CI not working - by El Forum - 11-25-2010, 05:35 PM
Jquery ajax and CI not working - by El Forum - 11-25-2010, 05:47 PM
Jquery ajax and CI not working - by El Forum - 11-25-2010, 07:32 PM
Jquery ajax and CI not working - by El Forum - 11-25-2010, 07:35 PM
Jquery ajax and CI not working - by El Forum - 11-25-2010, 07:43 PM
Jquery ajax and CI not working - by El Forum - 11-26-2010, 12:59 AM
Jquery ajax and CI not working - by El Forum - 11-26-2010, 11:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB