title: Laravel Validator return json
body: <p>same as title, i want to get message of validator in file javascript.</p>
  
  <p>in file Controller:</p>
  
  <pre><code>public function processTest()
      {
          if (Request::ajax() &amp;&amp; Request::method()==='POST') {
  
              $validator = Validator::make(Input::all(), array(
                  'firstname' =&gt; 'required',
                  'lastname' =&gt; 'required',
                  'email' =&gt; 'required|email|max:50|unique:tbl_account',
              ));
  
              return $validator-&gt;messages()-&gt;toJson();
  
          } else {
              return Redirect::route('home');
          }
      }
  </code></pre>
  
  <p>in file dev.js:</p>
  
  <pre><code>$(document).ready(function() {
      $('#test-form').submit(function() {
  
          $.ajax({
              url: $(this).attr('action'),
              type: 'POST',
              dataType: 'json',
              data: $(this).serialize(),
              success: function(data) {
                  alert(data);
              }
          });
  
          return false;
      });
  });
  </code></pre>
  
  <p>but not working, it result empty, somebody can help me????</p>