Javascript 如何使用js将json响应插入<;a>;xxxx</a>;

Javascript 如何使用js将json响应插入<;a>;xxxx</a>;,javascript,jquery,html,json,tumblr,Javascript,Jquery,Html,Json,Tumblr,我正在尝试在我的tumblr帖子中实现一个“最新”的小部件。到目前为止,我已经能够从这篇文章中获得使用json的前5篇文章(http://stackoverflow.com/questions/5617378/how-to-display-a-link-to-my-latest-tumblr-post-using-javascript). 我想知道如何将{title}插入到xxx中,以便链接显示最近文章的标题 我想我需要使用.append或.html,但我不知道如何使用。有人能帮帮我吗 脚本:

我正在尝试在我的tumblr帖子中实现一个“最新”的小部件。到目前为止,我已经能够从这篇文章中获得使用json的前5篇文章(http://stackoverflow.com/questions/5617378/how-to-display-a-link-to-my-latest-tumblr-post-using-javascript). 我想知道如何将
{title}
插入到xxx中,以便链接显示最近文章的标题

我想我需要使用.append或.html,但我不知道如何使用。有人能帮帮我吗

脚本:

$.getJSON('http://brianjsmith.tumblr.com/api/read/json?callback=?',
function(response) {
   $('#myLink').attr('href',response.posts[0].title);
});
html:

最近的帖子{title}
更新: 检查响应后,没有
标题
属性,只有
常规标题

$('#myLink').attr('href',response.posts[0].url).text(response.posts[0]['regular-title']);

.文本部分对我不起作用。和之间没有文本,没有文本则完全相同。@LapMingLee这是因为没有title属性,您是否自己检查了响应,请尝试我的更新答案。
$('#myLink').attr('href',response.posts[0].url).text(response.posts[0].title);
$('#myLink').attr('href',response.posts[0].url).text(response.posts[0]['regular-title']);
$("#myLink").html('Most recent post' + response.posts[0].title)