Results 1 to 4 of 4

Thread: Stars Rating script not working (on Weebly)

  1. #1
    Join Date
    Aug 2012

    Question Stars Rating script not working (on Weebly)

    I have created a site in Weebly, a drag and drop website builder. Now, I would like to have a rating script to rate a product with stars. It has to be SEO friendly (if you find the product page in Google, I want to see the stars in Google).
    So now I have this: www.serresvantack.be . It looks nice, but it doesn't work. It doesn't save the rating.
    The script:
    On the page I have this:

    <ul class='star-rating'>
    	<li class='current-rating' id='current-rating' style="width: 37px"></li>
    <li><a href="#" onclick="/files/theme/post(1); return false;" 
               title='1 star out of 5' class='one-star'>1</a></li>
    	<li><a href="#" onclick="/files/theme/post(2); return false;" 
               title='2 star out of 5' class='two-stars'>2</a></li>
    	<li><a href="#" onclick="/files/theme/post(3); return false;" 
               title='3 star out of 5' class='three-stars'>3</a></li>
    	<li><a href="#" onclick="/files/theme/post(4); return false;" 
               title='4 star out of 5' class='four-stars'>4</a></li>
    	<li><a href="#" onclick="/files/theme/post(5); return false;" 
               title='5 star out of 5' class='five-stars'>5</a></li>
    <div id='current-rating-result'></div> <!-- used to show "success" message after vote -->
    I also have this file, called post.js:
    <script language="javascript">
    function vote(amnt){
    		type: "POST",
    		url: "/files/theme/post.php",
    		data: "item_id=12345&vote=" amnt,
    		dataType: "json",
    		success: function(res){
    and an empty post.php.

    Can someone find the mistake in this?
    Thank you so much!

  2. #2
    Join Date
    Feb 2011
    The file "post.php" should contain the php script that registers the ratings. In this case, if it is empty, you can ask the person who made the script.
    Or try another script, for example this: Ajax-PHP Rating Stars Script

  3. #3
    Join Date
    Aug 2012
    Thanks for your response!
    I've just seen that there actually was post.php code. But it still doesn't works.
    PHP Code:
    $vote_amount = (int)$_POST['vote'];
    $vote_amount = ($vote_amount<1) ? min($vote_amount5);

    // some processing of vote against item_id here...

    // each star is 25px wide, so to highlight 3 and a half stars you would return 
    // a width of 87

    $return_json = array(
    "width" => 87
    "status" => "Your vote of $vote_amount was successful!",


  4. #4
    Join Date
    Feb 2011
    In the script in "post.php" there is no code which to save the ratings. It just gets data, and return it in JSON format.
    It think it is needed more code which saves data into a file, or database, but it is missing.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles