Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Ajax Posting

  1. #1
    New Coder
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Ajax Posting

    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?

    Code:
    <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.
    Code:
    parameters: event.memo.rating + '&id=1',
    I hope you can help.

  • #2
    New Coder
    Join Date
    Jan 2007
    Posts
    13
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Bump.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •