我正在使用下面的代码将我的 Tumblr 主页重定向到我的最新帖子。
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script>
$(document).ready(function() {
$.getJSON('http://mydomain.tumblr.com/api/read/json?callback=?', function(result) {
window.location.href = result.posts[0].url;
});
});
</script>
我有两个问题。首先,它不会立即重定向,它会加载我的主页,然后更改 URL,即使我已将其放在我的<head>
标签上方。然后,当它确实重定向时,它每隔几秒钟就会开始刷新一次。提前感谢您的帮助。