[eluser]CodeIgniteMe[/eluser]
Error messages will not be displayed yet if your AJAX code is as simple as this.
First, remove the line that returns false in your controller, so the entire HTML will be outputted from the server-side and is received by AJAX. Second, do not return true from your controller because AJAX/Javascript cannot read boolean from other language (such as PHP). Echo it instead, then exit to terminate the script. Your controller should look more like this
Code:
if($this->user_model->check_login($data)== TRUE)
{
echo 'success';
exit();
//$this->load->view('home');
}
else
{
$this->load->view('failure');
//return FALSE;
}
Third, since the entire HTML is returned to AJAX if the login is incorrect, do this condition
Code:
success: function(response){
if(response=='success')
{
alert('success');
}
else
{
$('form').prepend(response);
}
try it so you'll know if it will work