js讀取本地json文件數(shù)據(jù) js怎么加載&解析json文件,原生的?
js怎么加載&解析json文件,原生的?<script language=“javascript”>function getjson(){var xmlReq try{xmlReq=new A
js怎么加載&解析json文件,原生的?
<script language=“javascript”>function getjson(){var xmlReq try{xmlReq=new ActiveXObject()Microsoft.XMLHTTP)var web=”1。JSON“//JSON文件路徑//異步模式xmlReq.open打開(“GET”,web,true)xmlReq.onreadystatechange文件=函數(shù)(){如果(xmlReq.readystate文件== 4){ 文檔.寫入( xmlReq.responseText文件)//對JSON文件的操作}xmlReq.send發(fā)送()catch(e){alert(e)}}</script>