• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Internal server error when calling AJAX

#1
[eluser]dauber[/eluser]
So I'm trying to call my "login" method from my "Login" controller via AJAX, with jQuery. But I keep getting an internal server error, saying "The action you have requested is not allowed." I pretty much copied and pasted this from another site I'm working on...

Here's my controller:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller {
    
        public function construct() {
            parent::__construct();
            $this->load->helper('form');
        }

public function index() {
}
        
        public function login() {
            $email = $this->input->post('email',TRUE);
            $password = $this->input->post('password',TRUE);
        }
}

Here's the AJAX call:

Code:
var email = $('#ltd_email').val();
            var password = $('#ltd_password').val();
            var login_post_data = {
                'email': email,
                'password': password
            };
            $.post('/index.php/login/login',login_post_data,function(result) {
                console.log("RESULT:");
                console.log(result);
            });

#2
[eluser]dauber[/eluser]
Never mind -- this thread answered my question; for some reason Duck Duck Go didn't give me the result that Google did....:

https://ellislab.com/forums/viewthread/163976/


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.