title: Uncaught TypeError: Cannot read property 'team' of null
body: <p>I have this game I'm making and I'm using ajax call to php to get items from the database, but I getting getting an error so the preloader doesn't go away, and I get this error when i view the resources on Chrome : "Uncaught TypeError: Cannot read property 'team' of null". Any idea why it's doing this?
  Jquery:</p>
  
  <pre><code>function appendTeam(){
  
  $.ajax({
  
         url : _path + "/core/ajax.php",
         type : 'POST',
         data : { f: 'getTeam'},
         dataType : 'json',
         success :  function(data) {
  
          if(data) {
  
  
              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)).append(element);
                  element.data('prevParent', $('.slot.'+(i+1)));
                  count ++;
  
              });
  
              appendStatus(count);
              setTimeout(function(){
                  $('#preloader').fadeOut('fast',function(){
                      $('#preloader').remove();
                      popUp('match');
                  });
              }, 2000);
  
  
          }
  
      }
  });
  }
  </code></pre>
  
  <p>Php:</p>
  
  <pre><code>if (isset($_POST['getTeam'])) {
  $team = array();
  $sql = mysql_query("SELECT * FROM accounts WHERE id = '1'")  or die(mysql_error());
  
  
  while ($teams = mysql_fetch_array( $sql )) {
  
  $chara1 = $team['cid1'];
  $chara2 = $team['cid2'];
  $chara3 = $team['cid3'];
  
  }
  $team = json_encode(array(
  'chara1' =&gt; $chara1,
  'chara2' =&gt; $chara2,
  'chara3' =&gt; $chara3
  ));
  echo $team;
  }
  </code></pre>
  
  <p>And I want it to echo the team, if he has a team already selected in these div elements :</p>
  
  <pre><code>&lt;div id="droppable_slots" class="current_team"&gt;
                      &lt;div class="slot 1"&gt;1&lt;/div&gt;
                      &lt;input type="hidden" name="s0" value="10"&gt;
                      &lt;div class="slot 2"&gt;2&lt;/div&gt;
                      &lt;input type="hidden" name="s1" value="7"&gt;
                      &lt;div class="slot 3"&gt;3&lt;/div&gt;
                      &lt;input type="hidden" name="s2" value="3"&gt;
                  &lt;/div&gt;
  </code></pre>