1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2007
    Rep Power

    Getting help making a script use ajax/jquery?

    I have an old rating system I use on multiple websites that works exactly how I need it to (meaning I'd rather not replace it) with the exception of one thing: It refreshes the page in order to display/update the vote.

    It is a PHP script (_drawrating.php) which is required on the page you want to display a rating on, and called via:

    PHP Code:
    <?php echo rating_bar(''.$id.'','5'); ?>
    On one site, there are puzzles that require that the screen not be refreshed, or the puzzle reverts back to it's original state - so the problem is, if someone rates the puzzle halfway through solving it, they lose their work.

    Would there be an easy way to save and update the rating without a refresh using AJAX / Jquery which wouldn't require a rewrite of _drawrating.php ?

    (Also, if you need to see the code for _drawrating.php in order to answer this question, I can provide it. Bit lengthy so leaving it out for now if it's not absolutely needed.

    Thank you.
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Rep Power
    Here is jQuery's Examples (on their .ajax() API documentation page); that should provide you some basic idea, how to send a query to your PHP page with the jQuery .ajax() API (by end user clicking on: link, button, image, etc.):http://api.jquery.com/jQuery.ajax/#entry-examples.

IMN logo majestic logo threadwatch logo seochat tools logo