When user get Registration using registration form this time 
if email already email exist in data base this show a message "the email Already exist" others user can complete registration.
but can't show message what am i wrong?

My Controller 

```
public function emailCheck()
{
    $this->autoRender = false;
    $this->viewBuilder()->layout('false');
    if ($this->request->is(['post'])) {
         $search =$this->request->data('email');                                                  
         $query = $this->Users->find('list', [
                              'conditions' => ['Users.email LIKE '=>'%' .$search. '%'],
                              'limit' => 1
                              ])->all();
         foreach ($query as $key) {
             if($key!=null){
                echo "This email has been taken!!";
             }else
             echo "Email avilable.";
         }
    } 
}

```

My Ajax 

```
<script>
$('document').ready(function(){
    $('input[name="email"]').change(function(){
        var email = $(this).val();
        $.ajax({
                  method:'POST',
                  url:'<?php echo Router::url(['controller' => 'Users', 'action' => 'emailCheck']); ?>',
                  data:{search:email},
                  success: function(data)
                  {
                    alert(data);
                  }
        });
    })
})

```