0
我有一個JSON文件:example_json.json這個文件看起來像這樣:編寫JavaScript變量JSON文件
{
"timeline":
{
"headline":"WELCOME",
"type":"default",
"text":"People say stuff",
"startDate":"10/4/2011 15:02:00",
"date": [
{
"startDate":"10/4/2011 15:10:00",
"endDate":"10/4/2011 15:55:00",
"headline":"prvo",
"text":"<p>dddddddddddddddd dd</p>",
"asset":
{
"caption":"yessss"
}
},
{
"startDate":"10/4/2011 17:02:00",
"endDate":"10/4/2011 18:02:00",
"headline":"drugo da da",
"text":"<p>In true political fashion, his character rattles off common jargon heard from people running for office.</p>",
"asset":
{
"media":"http://youtu.be/u4XpeU9erbg",
"credit":"",
"caption":""
}
}
]
}
}
所以這是例如JSON文件。
在另一邊,我有這個變量:
var place.name;
var zajson;
和:<button>Add to timeline</button>
現在我想,當我點擊按鈕「添加到時間線」創建新的「元素」裏面的「日期」與「的startDate」是:curentDateFormat格式月/日/年+ zajson
,並添加「標題」:place.name
我如何添加這個變量並在example_json.json中的「日期」內創建新的元素?
怎麼可以寫這個變量example_json.json文件??? – drTesla
另一邊?你的意思是天堂? –
對不起,我的英文不好... – drTesla