打错了节点的id了晕Uncaught TypeError: Cannot read property 'innerHTML' of null<script type="text/javascript">function getmore(){var p = document.getElementById("result").innerHTML;alert(p)var xhr = new XMLHttpRequest();xhr.open('GET', '{{url_for('api.get_posts')}}',true);xhr.onreadystatechange = function(){if(xhr.readyState ==4 && xhr.status == 200){ // alert('success');
document.getElementById("result").innerHTML = xhr.responseText; var data = JSON.parse(xhr.responseText);
if(data){ console.log(xhr.responseText);
p = "fff";
} else { console.log('nothing');
}
}else{ console.log('ajax error');
}}xhr.send();}</script>
添加回答
举报
0/150
提交
取消