如何在表格中显示时将我的JSON文件中的URL值设置为超链接?JSON文件中的超链接URL值
JSON
{
"one": "http://urltovideo.mp4",
"two": "The second list item",
"three": "The third list item"
}
jQuery的
$.getJSON("test.json", function(data) {
var items = [];
$.each(data, function(key, val) {
items.push("<div class='panel panel-default'><div class='panel-heading'>" + key + "</div><div
class='panel-body'><a href=''>" + val + "</a></li></div></div>");
});
$("<ol/>", {
"class": "my-new-list",
html: items.join("")
}).fadeIn(900).appendTo("body");
});
你只需要更缓慢地走一点点就行items.push。也许你想在这之前有一个if语句来分离出超链接? – ControlAltDel 2014-09-05 14:30:47
[是不是那些超链接已经?](http://jsfiddle.net/1L7hf6L5/) – 2014-09-05 14:39:52