我想加载一个 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"
""
""
我还想确保数据与图片相关联,这样模态就不会混淆。如果这有点令人困惑,我很抱歉。如果有人有任何疑问,我会尽力澄清。