I can currently using starbox and an ajax event to save a users rating on a video they have seen. However I also need to post the id of the video to the back end php.
How can I do this? What is the safest way to do this as well so I can prevent the user from modifying the js?
<html>
<link rel="stylesheet" type="text/css" href="css/starbox.css" />
<script src='js/prototype.js' type='text/javascript'></script>
<script src='js/scriptaculous/scriptaculous.js?load=effects' type='text/javascript'></script>
<script src='js/starbox.js' type='text/javascript'></script>
<script type="text/javascript">
document.observe('starbox:rated', saveStar);
function saveStar(event) {
new Ajax.Request('savestar.php', {
parameters: event.memo.rating + '&id=1',
onComplete: function() {}
});
}
</script>
<div class='star'>
<div id=star><img src='images/loading.gif' alt=''/></div>
<script language='javascript' type='text/javascript'>
new Starbox('star', 5.6011, { overlay: 'pointy.png', className: 'pointy', identity: 'star', max: 8, buttons: 8, stars: 8, total: 5, indicator: '#{average} average after #{total} votes'} );
</script>
</div>
</html>
I have tried this but I don't know why it doesn't work. I can pick up the id variable but not the rated variable.
parameters: event.memo.rating + '&id=1',
I hope you can help.