我在JSON jQuery $.each function
中循环json = [
[
"Exodus Gods and Kings 2014",
"720p",
"986MB",
"6.1",
false,
"Christian Bale, Joel Edgerton, John Turturro, Aaron Paul",
"3 nominations.",
"UK, USA, Spain",
"Ridley Scott",
"2014",
"http:\/\/4upld.com\/3Azrc",
"150 \u062f\u0642\u06cc\u0642\u0647",
"Adam Cooper, Bill Collage, Jeffrey Caine, Steven Zaillian",
"English"
],
[
"American Sniper 2014 720p",
"720p",
"900 MB",
"7.4",
false,
"Bradley Cooper, Kyle Gallner, Cole Konis, Ben Reed",
"Won 1 Oscar. Another 8 wins & 30 nominations.",
"USA",
"Clint Eastwood",
"2014",
"http:\/\/4upld.com\/2eB70",
"132 \u062f\u0642\u06cc\u0642\u0647",
"Jason Hall, Chris Kyle (book), Scott McEwen (book), James Defelice (book)",
"English"
]
]
时遇到问题
最初我有这样的JSON:
$.getJSON( "json", function( data ) {
$.each(data, function(e,p) {
$(".title").append('<a>'+p[0]+'-'+p[1]+'</a><br>');
});
});
我想循环遍历JSON(aaa和bbb)中的所有键/值元素并检索内部JSON数组以便再次循环,所以我尝试了:
<nav class="nav-bar"></nav>
<div class="container">
<div class="movie">
<div class="cover">
<img src="././cover.jpg">
</div>
<div class="title">
<a></a>
</div>
</div>
</div>
如何每次执行循环并将数据放入HTML元素?这样每次都可以重构HTML元素。
HTML:
{{1}}
演示:Fiddle