Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4581078
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:52:25+00:00 2026-05-21T20:52:25+00:00

EDIT : Removing the ‘index.php’ with .htaccess creates this probem I just discovered. Now

  • 0

EDIT: Removing the ‘index.php’ with .htaccess creates this probem I just discovered. Now I’m on to resolving it.

EDIT: Problem solved. The javascript was wrong: url: "/login/" It needed a trailing slash.

ORIGINAL: In my home view, I created a form:

<div id="login"><?php 
echo form_open('login');
echo form_input('username', 'Username', 'id="username"');
echo form_submit('submit', 'Login', 'id="login_submit"');
echo form_close();
?></div>

With some basic javascript (thanks to Nettuts) I tried to implement some ajax:

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

var form_data = {
    username: $('#username').val(),
    password: $('#password').val()      
};

$.ajax({
    url: "/login",
    type: 'POST',
    data: form_data,
    success: function(msg) {
        $('#login').html(msg);
    }
});

return false;
});

As you can see, it sends the form values to the login controller.

class Login extends CI_Controller {

function index()
{
    if($this->input->is_ajax_request())
    {
        echo '<h2>Login succeeded with ajax</h2>';
    }
    else
    {
        echo '<p>But your ajax failed miserably</p>';
    }
}

}

The problem is, it doesn’t work. The function $this->input->is_ajax_request() outputs FALSE. Ignoring that, every other post data is missing. Nothing is put through.

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T20:52:26+00:00Added an answer on May 21, 2026 at 8:52 pm

    I think your problem could be that you’re not actually sending to the correct script. Your url /login doesn’t look like it will get to a Codeigniter URL (http://domain.com/index.php/login or http://domain.com/my_app/index.php/login).

    Try changing the url to either the full url location of the controller or to a proper absolute path. Either:

    url: "http://yourdomain.com/index.php/login",
    

    or

    url: "/my_app/index.php/login",
    

    Unless you’ve rewritten the urls then /login probably won’t contact the correct script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: for those who come here with a similar problem, now i know this
EDIT: There's now a doc page on this so this question is irrelevant, also
Edit: I figured this out. jQuery Cycle plugin adds a z-index to every item
EDIT #3 : Microsoft has released a 'fix' to this problem which is available
Edit: This may be a 5.0-specific bug. (I'm on 5.0.83). Removing the innodb_log_file_size setting
I have never before rewritten a URL except for removing the index.php part of
EDIT 1: You can try this by removing the sortable script from the link
EDIT: There is the almost same question at Removing whitespace between HTML elements when
After removing hash from URL using window.location.hash='' page getting reloaded in firefox. EDIT Example:
EDIT: Now a Major Motion Blog Post at http://messymatters.com/sealedbids The idea of rot13 is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.