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.
On the page I have this:
I also have this file, called post.js:
<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 -->
and an empty post.php.
data: "item_id=12345&vote=" amnt,
Can someone find the mistake in this?
Thank you so much!
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
Thanks for your response!
I've just seen that there actually was post.php code. But it still doesn't works.
$vote_amount = (int)$_POST['vote'];
$vote_amount = ($vote_amount<1) ? 1 : min($vote_amount, 5);
// 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!",
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.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)