title: check username availability with ajax in laravel
body: <p>I am using this function to check the username availability type function in laravel framework-</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          $("#clanname").keyup(function(e) {
  
          var clanname = $(this).val();
          if(clanname.length &lt; 4){$("#user-result").html('');return;}
  
          if (clanname.length &gt;= 4) {
              $("#user-result").html('&lt;img src="images/ajax-loader.gif" /&gt;');
              $.post('/Myclan/checkClanname', {'clanname':clanname}, function(data) {
                 console.log(data);
              });
          }
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>which calls the controller Myclan/checkClanname -</p>
  
  <pre><code>public function checkClanname() {
          $clanCount = Clan::where('clanname', '=', Input::get('clanname'))-&gt;count();
          if ($clanCount == 0) {
              return true;
          } else {
              return false;
          }
      }
  </code></pre>
  
  <p>but I am getting an error popup</p>