title: JSON or Jquery error: Uncaught TypeError: Cannot read property 'error' of null
body: <p>I am trying to make an ajax call using the below jQuery.</p>
  
  <p>But I can see in Chrome, i'm getting uncaught typeerror cannot read property 'error' of null. So this stops the preloader from going away. Any idea why it's doing this?</p>
  
  <pre><code>function appendTeam(){
  
  $.ajax({
  
         url : _path + "/core/ajax.php",
         type : 'POST',
         data : { f: 'getTeam'},
         dataType : 'json',
         success :  function(data) {
  
          if(data.error){
  
              errorMessage('Error: ' + data.error, data.error, data.error);
              return false;
  
          }else{
              var count = 0;
              $.each(data.team, function(i, c){
                  // check
                  if(!$('#'+c)) return true;
                  var element = $('#'+c);
                  $('input[name="s'+i+'"]').val(element.attr('id'));
                  $('.slot.'+(i+1)+'.ui-droppable').append(element);
                  element.data('prevParent', $('.slot.'+(i+1)+'.ui-droppable'));
                  count ++;
  
              });
  
              appendStatus(count);
              setTimeout(function(){
                  $('#preloader').fadeOut('fast',function(){
                      $('#preloader').remove();
                      popUp('match');
                  });
              }, 2000);
  
  
          }
  
      }
  });
  }
  </code></pre>