我无法获取带变量的链接标记。我尝试在div周围包裹一个href
标签,但它一直在向我抛出错误。这是有效的代码,我正在努力使result.response.docs["0"].web_url
成为一个链接
$.ajax({
url: url,
method: 'GET',
}).done(function(result) {
$(".articles").append("<div id=link>" + result.response.docs["0"].web_url + "</div>");
}).fail(function(err) {
throw err;
});
答案 0 :(得分:0)
这是你在找什么?
$.ajax({
url: url,
method: 'GET',
}).done(function(result) {
$(".articles").append("<div id=link><a href='" + result.response.docs["0"].web_url + "'>Click me if you dare</a></div>");
}).fail(function(err) {
throw err;
});