在network那里看到j(luò)son已經(jīng)成功獲取了,但是在控制臺打印返回的數(shù)據(jù)卻是為空。代碼如下: <script> var xhr=window.XMLHttpRequest ? new XMLHttpRequest() : ActiveXObject('Microsoft.XMLHTTP'); xhr.onreadystatechange=function(){ if(xhr.readyState===4&&xhr.status===200){ console.log(xhr.reponseText) var placeMap=JSON.stringify(xhr.reponseText); } } xhr.open('GET','placesMap.json',true); xhr.send(); </script>
用原生ajax獲取json成功,但是沒有數(shù)據(jù)返回
開滿天機(jī)
2019-02-21 18:19:52