我希望从我的帐户twitter php数据json获取Feed,我的php已经完成并正常工作,但是jquery的问题有错误
未捕获的TypeError:无法读取属性'长度'未定义的
$(document).ready(function() {
var dmJSON = "get_tweets.php";
$.getJSON(dmJSON, function(data) {
var html = '';
for (var i = 0; i < data.array.length; i++) {
html += '<div style="width: 600;direction: rtl;background-color: white;padding: 12px 12px 0;border: 1px solid;border-color: #e5e6e9 #dfe0e4 #d0d1d5;border-radius: 4px;margin-bottom: 20px;color: black;">';
html += '<span style=""> ' + data.array[i].text + ' </span><span></span>';
html += '</div>';
}
// append all the html variable to the ticker div.
$('.tweets-container').append(html);
});
});
我希望为重新加载页面添加自动更新json的时间
感谢
答案 0 :(得分:0)
我修复了
$(document).ready(function() {
var dmJSON = "get_tweets.php";
$.getJSON( dmJSON, function(data) {
var html = '';
// loop through all the news items, and append the
// title and published date to the html variable.
for(var i = 0; i < data.length; i++){
html += '<div style="width: 600;direction: rtl;background-color: white;padding: 12px 12px 0;border: 1px solid;border-color: #e5e6e9 #dfe0e4 #d0d1d5;border-radius: 4px;margin-bottom: 20px;color: black;" class="container-fluid">';
html += '<h4>' + data[i].text + '</h4>' ;
html += '</div>';
}
// append all the html variable to the ticker div.
$('.tweets-container').append(html);
});
});