Search code examples
ajaxxmlhttprequest

Ajax script not functioning correctly after server change


I have a website which runs a star rating ajax script, from the follow source.

http://coursesweb.net/php-mysql/rating-stars-script-ajax-php_s2

I have changed hosting for the website from a shared platform to a dedicated server which I control with Plesk. Since the change, the rating script has stopped working. All other aspects of the site are functioning correctly.

The following error is logged in the browser console.

Uncaught SyntaxError: Unexpected identifier at XMLHttpRequest.cerere_http.onreadystatechange (ratings.js:12)

Does XMLHttpRequest have to be enabled before this will work?

Can anyone offer advice as to why this may have happened?


Solution

  • The update to the server meant that the database connection now uses

    localhost:3306

    The rating script uses a PDO connection which requires that the hostname and PDO be separated.