Reputation: 4820
I am calling this controller via Ajax:
class Landing extends CI_Controller
{
function __construct()
{
parent::__construct();
}
function Index()
{
if ( $smt ){
return TRUE;
}else{
return FALSE;
}
}
}
And the response comes back empty, though if replace :
return TRUE;
by
echo TRUE;
exit;
It works. I was wondering why?
Upvotes: 2
Views: 4006
Reputation: 1346
When you do an ajax call, the response is the HTML script that is returned from a URL. If you were to create an empty PHP file with
return TRUE;
it would show nothing to the user viewing the file, however
echo 'true';
would return a string. This is what your AJAX call picks up.
Upvotes: 7