1
我正在通过每半分钟发送一次请求更新页面上的某个帖子,然后在页面上显示更新的帖子。Chrome,Safari - 未捕获TypeError:无法读取null的属性'状态'
它在FireFox中正常工作,但在Chrome和Safari中显示错误“无法读取null属性”状态。以下是我的JavaScript代码发送请求并显示成功的结果。
var updatePost = function() {
var lastid = document.getElementById('lastTopic').value;
en4.core.request.send(new Request.JSON({
url : en4.core.baseUrl + 'group/topic/topic-update',
data : {
format : 'json',
lastid : lastid,
topic_id : '<?php echo $this->topic->getIdentity(); ?>',
group_id : '<?php echo $this->group->getIdentity(); ?>',
},
onRequest:function()
{
},
onSuccess : function(responseObject) {
if(responseObject.status) {
// Remove old last topic id
$('lastTopic').remove();
//Add notification at top of list
$('topicUpdateNotify').innerHTML = "<a href='javascript:void(0);' onclick='scrollToPost("+responseObject.newLastId+");'>New Post update is available - click this to show it. </a>";
// Append li to list with content
var ul = document.getElementById("group_discussions_thread");
var newLI = document.createElement("LI");
newLI.innerHTML = responseObject.body;
ul.appendChild(newLI);
}
}
}));
};
在请求成功,我已经检查了使用if(responseObject.status) {}
状态。它正在FF中正常工作,但未在Chrome和Safari中显示结果。
我在zend框架中工作。
请提出任何解决方案。