() ajax 如何更新DOM

打错了节点的id了晕
Uncaught TypeError: Cannot read property innerHTML of null
<script type=”text/javascript”>
function getmore{
var p = document.getElementById”result”.innerHTML;
alertp
var xhr = new XMLHttpRequest;
xhr.openGET, {{url_forapi.get_posts}},true;
xhr.onreadystatechange = function{

ifxhr.readyState ==4 && xhr.status == 200{ // alertsuccess; document.getElementById"result".innerHTML = xhr.responseText; var data = JSON.parsexhr.responseText; ifdata{ console.logxhr.responseText; p = "fff"; } else { console.lognothing; }
}
else{ console.logajax error;
}

}
xhr.send;
}
</script>

Uncaught TypeError: Cannot read property innerHTML of null

这就不是 AJAX 的问题了吧

发表评论

电子邮件地址不会被公开。 必填项已用*标注