打错了节点的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>
当年话下
相关分类