一.txt内容
1.Controls/listStr.txt:
[ { "id":1, "pId":-1, "name":"XX项目", "open":true }, { "id":1122, "pId":1, "name":"XX详情", "open":true } ]
二、json读取:
1.引入JQUERY
2.js:
1 $.ajax({ 2 3 url: '/Controls/listStr.txt', 4 scriptCharset: 'utf-8', 5 success: successLoad 6 7 }); 8 9 10 function successLoad(data) { 11 var obj= JSON.parse(data); 12 obj[0].open= false; 13 //...... 14 15 }