테이블에 표시 될 때 내 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");
});
jsFiddle를 참조하면 그냥 items.push 라인에 더 천천히 조금 이동해야합니다. 하이퍼 링크를 구분하기 위해 if 문을 사용하기를 원할 수도 있습니다. – ControlAltDel
[해당 하이퍼 링크가 이미 있습니까?] (http://jsfiddle.net/1L7hf6L5/) –