function loadjson() {
var xmlhttp = new XMLHttpRequest();
var url = "json/school.json";
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var jsonDoc = JSON.parse(xmlhttp.responseText);
myFunction(jsonDoc);
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
function myFunction(jsonDoc) {
document.getElementById("id01").innerHTML=jsonDoc[0].name;
document.getElementById("id02").innerHTML=jsonDoc[1].name;
document.getElementById("id03").innerHTML=jsonDoc[2].name;
//將json物件轉成string文字
txt01.value = JSON.stringify(arr);
}
//將json物件轉成string文字
txt01.value = JSON.stringify(jsonDoc);
var jsonDoc = JSON.parse(jsonstring);
txt01.value = JSON.stringify(jsonDoc);
[
{"ip":"http://www.tsu.edu.tw/","name":"台灣首府大學","address":"台南市麻豆區南勢里168號","tel":"06-5718888","pic":"icon80_80/image01.jpg"},
{"ip":"http://web.ncku.edu.tw/","name":"成功大學","address":"臺南市東區大學路1號","tel":"06-2757575","pic":"icon80_80/image02.jpg"},
{"ip":"http://www.nutn.edu.tw/","name":"台南大學","address":"台南市中西區樹林街二段33號","tel":"06-2133111","pic":"icon80_80/image03.jpg"},
{"ip":"http://www.feu.edu.tw/","name":"遠東科大","address":"台南市新市區中華路49號 ","tel":"06-5979566","pic":"icon80_80/image04.jpg"},
{"ip":"http://www.ksu.edu.tw/","name":"崑山科大","address":"台南市永康區崑大路 195 號","tel":"06-2727175","pic":"icon80_80/image05.jpg"},
{"ip":"http://www.stust.edu.tw/","name":"南台科大","address":" 台南市永康區南台街一號","tel":"06-2533131","pic":"icon80_80/image06.jpg"}
]