現在、私は検索するキーワードからすべてのツイートを読み込もうとしています。実際には10の結果がありますが、私は3つの結果しか表示されず、コンソールウィンドウにエラーメッセージが表示されています。Uncaught TypeError:ヌルのプロパティ 'bounding_box'を読み取ることができません。
これはエラーメッセージです:
Uncaught TypeError: Cannot read property 'bounding_box' of null
これは私のjsのコードです:
(function(){
var location = new Array();
var query = '%23CM0655';
var url = "search.php";
$.post(url, {query:query}, function(tweets){
console.log(tweets);
$("#tweetResult tbody").html("");
var geoEnabled = false;
var placeName = "";
var countryName = "";
for(var i=0; i<tweets.statuses.length; i++){
var row = $("<tr></tr>");
var img = $("<td><div class='div_pic'><img src='" + tweets.statuses[i].user.profile_image_url + "' class='tweetpic'/>"+
"<label class='user_name' hidden>"+tweets.statuses[i].user.screen_name+"</label>"+
"<label class='divlatitude' hidden>"+tweets.statuses[i].place.bounding_box.coordinates[0][0][0]+"</label>"+
"<label class='divlongtitude' hidden>"+tweets.statuses[i].place.bounding_box.coordinates[0][0][1]+"</label>"+
"</div></td>");
//var img = $("<td><div class='div_pic'><img src='" + tweets.statuses[i].user.profile_image_url + "' class='tweetpic'/></div></td>");
row.append(img);
// row.append($("<td></td>").html(tweets.statuses[i].user.screen_name));
row.append($("<td></td>").html(tweets.statuses[i].user.screen_name));
row.append($("<td></td>").html(tweets.statuses[i].text + "<br/>"));
geoEnabled = tweets.statuses[i].user.geo_enabled;
if(geoEnabled){
placeName = tweets.statuses[i].place.name;
countryName = tweets.statuses[i].place.country;
if(placeName != null){
row.append($("<td></td>").html(placeName + "," + countryName + "<br/>"));
}
row.append($("<td></td>").html("Location: " + tweets.statuses[i].place.bounding_box.coordinates[0][0][0] + ", " +
tweets.statuses[i].place.bounding_box.coordinates[0][0][1] + "<br/>"));
row.append($("<td></td>").html(tweets.statuses[i].created_at));
}
$("#tweetResult tbody").append(row)
}
});
setTimeout(arguments.callee, 60000);
})();
これは、エラーを示している行です。
"<label class='divlatitude' hidden>"+tweets.statuses[i].place.bounding_box.coordinates[0][0][0]+"</label>"+
は、任意のはありますこのエラーを解決する方法。特定のつぶやきの場所が有効でない場合でも、すべてのつぶやきを表示したい誰かが私にこれを助けることができますか?ありがとうございました。