title: Javascript Object showing null
body: <p>I am trying to populate am empty object with data being returned from a POST request. The data is being returned successfully, but in the code the object is found to be null. The code is given below:</p>
  
  <pre><code>var item = {};   
  var args= {p: "&lt;?php echo $id; ?&gt;"};
  
  $.post('api.php', args, function(response) {
  
      startSpinner(spinner);
      if (response.status == 0) {
          item = response.data;
          console.log("ITEM: " + JSON.stringify(item));
      }
  
  }).done(function() {
      ..
  });
  
  if (item == null || item == undefined) {
      alert("TTEMST");
  }
  </code></pre>
  
  <p>In the console log, the item is clearly being shown to get populated with data, but the if condition for a null object is somehow being satisfied, i.e. the alert box is being displayed. I think there is something wrong with the way I am populating the object. Please help!!</p>