 <p>I would suggest a console.log() before the if().</p> <pre><code>var url = "link"; $.getJSON(url,function(json) { console.log("Success received...") if ( json.length == 0 ) { console.log("NO DATA!") } }); </code></pre> <p>The full reference is here: <a href="http://api.jquery.com/jQuery.getJSON/" rel="nofollow">http://api.jquery.com/jQuery.getJSON/</a></p> <p>And you could also use the .done() capability:</p> <pre><code> $.getJSON(url) .done(function(json) { console.log("Success received...") if ( json.length == 0 ) { console.log("NO DATA!") } }); </code></pre> <p>It could be that somehow you json object is not empty.</p>