title: JSON is null but data passes to success in ajax
body: <p>I'm running into a problem in ajax. the scenario is: I would like to verify if the user is available or not when typing his email. So I create a function in javascript to do this with an Ajax script within it.
  here my code :</p>
  
  <pre><code>$('#username').keyup(function () {
    var email = $(this).val();
  
    $.ajax({
      type: 'GET',
      url: 'http://localhost:8080/MeublesTunisv4/web/app_dev.php/email-verification/' + email,
      dataType: "json",
      beforeSend: function () {
        $('#email_status').html('&lt;img id="loading" src ="{{ asset('bundles/theme_front_end/images/loading.gif')}}"&gt;&lt;/img&gt;');
  
      },
      success: function (data) {
        $('#email_status').remove();
        $('#email_status').html('&lt;img id="loading" src ="{{ asset('bundles/theme_front_end/images/green_tick.png')}}"&gt;&lt;/img&gt;');
      }
  
    });
  });
  </code></pre>
  
  <p>my problem is : when I type any words it calls the function of keyup then it passes into success even if the data is null. I would like to let it pass to the success only if the data is correctly done. 
  thank you.</p>