October 6th, 2013, 10:51 PM
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:
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.
<?php echo rating_bar(''.$id.'','5'); ?>
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.
October 13th, 2013, 10:06 AM
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.