0
我喜欢有一个数组包含10个不同的食谱,在每个页面上加载我想用这些食谱填充一个div,我是新的数组,但我不知道为什么没有在此提醒?从数组中挑选随机项并填充 - jQuery
var recipes = [{
"image": "image1.jpg",
"ingredients": {
"a": "eggs",
"b": "chips"
},
"link" : "google.com"
}, {
"image": "image2.jpg",
"ingredients": {
"a": "chocolate",
"b": "cheese"
},
"link" : "msn.com"
}];
var recipe = recipes[0];
alert(recipe);
http://jsfiddle.net/6otvzr1p/1/
我得到'[对象的对象]'是'alert'的正常输出当被要求显示一个JS对象时。 – Alnitak 2014-10-10 09:37:53
这在这里工作 – devqon 2014-10-10 09:37:54
'食谱[0] .image'是你想在你的HREF? – 2014-10-10 09:38:44