我正试图从使用[blog] .tumblr.com / random选择的tumblr帖子中抓取第一张图片,该图片会重定向到随机帖子。
这是我到目前为止所拥有的:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script>
var link = "http://simplyfoodgifs.tumblr.com/random";
$.ajax({
type: "GET",
url: link,
dataType: "json"
}).done(function() {
$(this).find("img").first().find("src")({
$('body').append("<img src='" + this + "'/>");
});
});
</script>
我还没有工作,有什么帮助吗?我应该使用API吗?我没有看到如何使用/随机的API。