I use this to check in my registration page, if the email already exists on my database:
$('#email').blur(function() {
  var email = $(this).val();
  $.post('ajax/get_request/check',{key:"email",value:email},function(data) {
    alert(data);
  });
});
It does works fine. However, I've noticed, if I access the ajax path via URL address bar of the browser, http://example.com/ajax/get_request/check, this displays blank. I tried this script to redirect if value is null.
//controller.php
public function check($key=NULL,$value=NULL)
{
  if(is_null($value)) redirect(base_url(),'refresh');
  // ... more scripts below ...
}
But this affect my ajax request response on registration. What I want to achieve here is to detect if the user access the ajax via registration form not when directly typing the path on the URL browser.
 
     
    