本节为大家介绍下js如何读写json文件,代码很简练
function funSave() {
var id = $('#testText1')[0].value;
var name = $('#testText2')[0].value;
var str = '{mydata:[' + '{id:' + id + ',name:' + name + '}' + ']}';
str = "{MyData:[{id:'" + id + "',name:'" + name + "'}]}";
//var json = eval('(' + str + ')');
var fso, tf;
try{
1