jQuery code:
$(document).ready(function() {
$('#hit').click(function() {
$.getJSON("http://search.twitter.com/search.json?q=stackoverflow&callback=?", function(data) {
alert(data.length);
});
}); // #button hit click evnet
}); // document ready
result is undefined.

I navigate the api call manually in browser, it does return me the data.

Why result is undefined with my jQuery getJSON call?
The returned
datais an object and not an array, sodata.lengthis undefined.But above procedure is not supported for all browsers. So you can try:
To check that if a key is present in an object (if you’re not sure) it’s better to use:
For you case:
if your query become invalid twitter will response with an error object so to confirm about successful query result you can use:
There is another process called
hasOwnProperty()