Hello,I am creating a windows 8 application using html and javascript. When I try to parse json file(txt) into an array ,it's always failed with the message "0x800a138f - JavaScript runtime error: Unable to get property 'responseText'
of undefined or null reference“,what's wrong ?
javascript :
var subGroupList = new WinJS.Binding.List();
WinJS.xhr({url:"/data/Groups.txt"}).then(function(jsonxhr){
var items = JSON.parse(jsonxhr.responseText);
items.foreach(function (item) {
subGroupList.push(item);
});
});
Groups.txt:
[{"subGroup":"观发识病",
"group":"基础篇",
"htmlFileName":"/data/0101.html",
"subGroupID":"0101",
"groupID":"01"
},
{"subGroup":"视目诊病",
"group":"基础篇",
"htmlFileName":"/data/0102.html",
"subGroupID":"0102",
"groupID":"01
},
{"subGroup":"咳嗽、咳痰",
"group":"内科",
"htmlFileName":"/data/0201.html",
"subGroupID":"0201",
"groupID":"02"
}
]