title: 401 Unauthorized error on ajax call laravel 5.2
body: <p>when i am doing ajax call i am getting error as 401 Unauthorized.</p>
  
  <p>this is my ajax code:</p>
  
  <pre><code>var email=document.getElementById( "email" ).value;
    if(email)
    {
        var data = 'email='+ email;
        $.ajax({
                type: 'POST',
                dataType: "json",
                data: {"_token": "{{ csrf_token() }}","data":data},
                url: "{{ URL::to('admin/check_email_exit') }}",
                success: function (response) {
                if(response=="1")
                {
                    $( '#email_status' ).html('Email Already Exists');
                    return false;
                }
                else
                {
                    $( '#email_status' ).html("");
                    return false;
                }
         }
         });
    }
      else
      {
           $( '#email_status' ).html("");
           return false;
      }
  </code></pre>
  
  <p>my route:</p>
  
  <pre><code>Route::post('admin/check_email_exit', 'CompanyController@check_email_exit');
  </code></pre>
  
  <p>this is my controller code that checks email exits or not:</p>
  
  <pre><code>public function check_email_exit(){
          $email = $_POST["email"];
          $user_email = DB::table('users')-&gt;where('email',$email)-&gt;select('*')-&gt;get();
          $use_email=count($user_email);
          if($use_email &gt; 0 )
          {
              return "1";
          }
          else
          {
              return "0";
          }
      }
  </code></pre>
  
  <p>how to resolve this error..??</p>