EMG wrote:
Hmm, if you can show me what to do I'd be happy to put some AJAX behind it.
First thing you would need to do is grab the AJAX lib you want, ill suggest prototype coz I know it ( http://www.prototypejs.org/ )
add the script tag into the head of the page(s)
then against the td with the voting results in it, add id="result[id]" (replace [id] with the id from the DB)
then add a function such as the below:
[code:1]
function vote(id, type) {
new Ajax.Updater('result' + id, '/modules.php?name=Voting&file=index',
{
parameters: {
VoteType: type,
VoteFor: id
}
}
);
}
[/code:1]
That function is to make it easy to spot the {}'s, and vars. You can make it all one line if it makes more sense, eg.
[code:1]
function vote(id, type) {
new Ajax.Updater('result' + id, '/modules.php?name=Voting&file=index&VoteType=' + type + '&VoteFor='+ id);
}
[/code:1]
More info on the call (including other options such as post, ) at:
http://www.prototypejs.org/api/ajax/updater
Now its just a matter of changing the link to href="javascript:vote([id], 1)"
(once again replace [id])
That will do the ajax, although.... the Updater call will update the div with the results from the page, so you should also change the output from the vote to be what now displays (eg. the new contents of that td you gave the id to)
I suspect once you have that working, you will start on other pages :)
Note, this code is untested its off the top of y head based on your site. If you need an example gimme a yell...