title: Check if .getJSON returned any data
body: <p>I'm trying to use KnockOutJS and jQuery - is there any way I can check <strong>allData</strong> below, to see if it has returned anything?</p>
  
  <p>If it hasn't, I want to hide a div on the screen:</p>
  
  <pre><code>$(document).ready(function () {
  
  $("#thankyou").hide(); // hide thank you box
  
  $("#searchBtn").click(function () {
  
      $.getJSON("/api/searchapi/", function (allData) {
          sampleProductCategories = allData;  // I want to check if this has returned anything?
          if(!allData) { alert("nothing");}
          cart.RoomCategories(sampleProductCategories);
      });
   });
  });
  </code></pre>
  
  <p>Firebug shows the empty JSON as:</p>
  
  <p><img src="https://i.stack.imgur.com/mp3MU.png" alt="enter image description here"></p>