Ajax-PHP Rating Stars Script

Place for comments, problems, questions, or any issue related to the JavaScript / PHP scripts from this site.
Sebastian
Posts:

Ajax-PHP Rating Stars Script

Has anyone downloaded/used this script: Ajax-PHP Rating Stars Script ?
I have inserted it into my html page with PHP that will input the data into mysql according to the instructions, but I have not gotten it to work. I wanted the user to be able to select one of five stars to rate a product, but no stars show up.
The script is a division class that on my page encloses the rating input field. The only thing that might be non-conforming to the script is that there is no image, article, etc. that is being rated.
The rating is to just be entered by the user, but not based on anything on a web page. Any thoughts?

Admin
Hi
The problem can be the path to the ".js" file, or to the php file in the javascript code, according to the page address; or error from other javascript code in page.
First, try the script on localhost to see if it works with the testing page, for example with XAMPP.

If the "ratings.js" file is properly included in the page, try modify the path to the php file in the "ratings.js".
Replace the line 105

Code: Select all

cerere_http.open("POST", '/ratingfiles/ratings.php', true);
with this code (it removes the starting "/"):

Code: Select all

cerere_http.open("POST", 'ratingfiles/ratings.php', true);
Or, use the absolute path to the "ratings.php"

Code: Select all

cerere_http.open("POST", 'http://'+ document.domain +'/ratingfiles/ratings.php', true);
You can change the 'http://'+ document.domain +'/ratingfiles/ratings.php' with the path to "ratings.php" on your website, for example:

Code: Select all

'http://domain_name/path_to/ratings.php'
Also, try see if there is any error in javascript console, for example with Mozilla Firefox and the Firebug addon.
- As the last case, you can add here the link to that page so I can check it.

Sebastian
I changed all the paths to absolute and tried "base href" and "includes" on every page, but nothing seems to help. Many hours spent. The div class srtgs is in a table cell. I have tried every combination of how the td is related to the div, but still no luck. One strange thing is the cell styling comes out as an empty square shape with rounded corners-not my styling. Here is the link:
consumerwize.com/ratingfiles/reviewform.htm

Admin
Hi,
You missed to add 2 slashes after the "http:".
In your code the path to ratings.js is "http:/...", with one slashe.
If you look in the development console (F12) in your browser, you can see the error.

Similar Topics