1. 程式人生 > >項目json代碼

項目json代碼

博客 ast .cn xmlhttp UNC ali thead fan type

gun.json文件代碼:

{ "Gun_class":[ "栓動式狙擊槍", "射手步槍", "突擊步槍", "沖鋒槍" ], "Bolt-on-sniper-rifle":[ { "name":"AWM", "box_magazine":"10", "bullet":".300馬格南步槍彈", "caliber":"7.62mm", "weight":"6.5kg (不含彈匣)" }, { "name":"M24", "box_magazine":"5", "bullet":"M118特種彈", "caliber":"7.62mm", "weight":"5.4kg(不帶瞄準鏡)" }, { "name":"Kar98", "box_magazine":"5", "bullet":"7.92×57mm步槍彈", "caliber":"7.92mm", "weight":"3.9kg (無彈藥裝填)" } ], "sniper-rifle":[ { "name":"MINI14", "box_magazine":"5,20,30", "bullet":"M193式5.56×45,mm和SS109式5.56×45,mm槍彈", "caliber":"5.56mm", "weight":"全槍質量(不含彈匣)----2.9kg" }, { "name":"SKS", "box_magazine":"10", "bullet":" 7.62×39mm", "caliber":"7.62mm", "weight":"未知" }, { "name":"SLR", "box_magazine":"30", "bullet":"SS109式5.56×45,mm槍彈", "caliber":"5.56mm", "weight":"步兵型----4.325kg" }, { "name":"MK14", "box_magazine":"20", "bullet":"7.62mm", "caliber":"7.62mm", "weight":"5.1kg" } ]
} gun.js文件代碼片段 var header = document.querySelector(‘header‘); var section = document.querySelector(‘section‘); var requestURL = ‘https://raw.githubusercontent.com/wusifan19980908/cdu.edu/master/gun.json‘; var request = new XMLHttpRequest(); request.open(‘GET‘, requestURL); request.responseType = ‘json‘; request.send(); var Guns ; request.onload = function () { Guns = request.response; setHeader(); setGuns(); } 遠端json代碼:https://github.com/wusifan19980908/cdu.edu/blob/master/gun.json 轉自:wusifan的博客

項目json代碼