Fivestar is a little contributed Drupal module that allows you to cast a vote on any content type. I prefer it to other rating modules because it's simple and elegant, and it can be skinned to your likes easily as well.
In a website i developed i needed to automatically load another node once a vote was assigned. To obtain this, i setted a random view as the homepage, and inserted a javascript call in the page's template (page.tpl.php).
This way, every time a vote is casted with Fivestar, the homepage reloads automatically giving back the next random node.
The javascript call code i used is the following:
<script type="text/javascript">
function fivestarResult(voteResult) {
$('div#fivestar-summary-'+voteResult.vote.id).html(voteResult.result.summary);
window.location = "http://www.myhomepage.com/";
};
</script>Do you know a better or more elegant way to obtain the same result? Let me know in the comments ;)
Post new comment