我想加载一个JSON文件,创建一个在Bootstrap Modal中的列表。我已经设置了当您单击某人的图片时,模态框会弹出。
我希望模态框里面能够显示类似以下内容的信息:
<li class="project span3" data-type="pfa">
<a data-toggle="modal" data-target="#myModal" class="thumbnail">
<img src="img/anon.jpg" alt="Kenneth Atkins" />
<h1>Kenneth Atkins</h1>
<p>[Description here]</p>
</a>
</li>
以下是JSON数据的示例:
var florida_exoneration = [
{
"last_name":"Atkins",
"first_name":"Kenneth",
"age":16,
"race":"Caucasian",
"state":"FL",
"crime":"Sexual Assault",
"sentence":"10 years",
"conviction":2004,
"exonerated":2008,
"dna":"",
"mistaken witness identification":"",
"false confession":"",
"perjury/false accusation":"Y",
"false evidence":"",
"official misconduct":"",
"inadequate legal defense":"",
"compensation":""
}
]
我希望模态框里面能够显示类似以下内容的信息:
Title = "first_name + last_name"
Age = "age"
Race = "race"
State = "state"
""
""
我还想确保数据与图片相关联,这样模态框就不会混淆。如果有点困惑,我很抱歉。如果有人有疑问,我会尽力澄清。