<!--
异步函数
setTimeout
readFile
writeFile
readdir
ajax
-->
<script>
function get(url,callback) {
var oReq = new XMLHttpRequest()
//当请求加载成功之后要调用指定的函数
oReq.onload = function () {
//我现在需要得到这里的 oReq.responseText
callback(oReq.responseText)
}
oReq.open("get",url,true)
oReq.send()
}
get('data.json',function (data) {
console.log(data)
})
</script>