How to display a link to my latest Tumblr post using Javascript?

六月ゝ 毕业季﹏ 提交于 2019-12-29 09:19:06

问题


I am looking for some help and would be VERY grateful for it. I would like to use Javascript to display a link to my latest Tumblr post. For example, it would be like:

<a href="http://brianjsmith.tumblr.com/post/4486283258/welcome-to-my-tumblr">Read   Post</a>

As you can see in the above code, the link is to my latest post. However, the latest post is (of course) going to change.... I can't seem to find anything online (I've been searching Google for a few hours) and I have been trying to create my own code with Tumblr's API settings with no luck.

I know I asked a question similar to this for Twitter. Also help with getting it to execute, because apparently I can't seem to get that working either. And once again any help would be amazing!


回答1:


i think this will get you what you need:

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

edit: ok, forget what i had before. doesn't work for tumblr apparently. this does though.



来源:https://stackoverflow.com/questions/5617378/how-to-display-a-link-to-my-latest-tumblr-post-using-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!