This jQuery script one creates a URL such as www.tumblr.com/like/fGKvAJgQ?id=16664837215
and then uses an iframe
to send the 'like' with the above URL to Tumblr's servers.
$(document).on('click', '.like', function (event) {
event.preventDefault();
var command = $(this).hasClass('liked') ? 'unlike' : 'like',
post = $(this).closest('.post'),
oauth = post.find('.reblog').attr('href').slice(-8),
id = post.attr('id'),
likeUrl = 'http://www.tumblr.com/' + command + '/' + oauth + '?id=' + id;
$('#like-it').attr('src', likeUrl);
$(this).toggleClass('liked');
});
In the HTML this is used:
<article id="{PostID}">
<a href="{ReblogURL}" class="reblog">reblog</a>
<a href="#" class="like">like</a>
</article>
<iframe id="like-it"></iframe>
Is there a way to send this information to Tumblr instead of using the iframe with jQuery?