Jorge Bellido
Jorge Bellido

Reputation: 79

PHP and MySQL voting system with jQuery

You can see my fiddle of what i'm doing here: fiddle

In vote_up.php I insert the vote into MySQL and replaces the link with 2 messages:

"successful" or "error"

But the problem now is, I don't need to change the link, I must update the 2 boxes showing a new question without reloading the page.

This is before I vote: Before voting up

And after I vote:After voting up

What i need when they click up(Aceptar) is it changes the question instead of showing that I voted. Thanks.

Upvotes: 0

Views: 389

Answers (2)

Jorge Bellido
Jorge Bellido

Reputation: 79

My problem resolved in other post:

$(document).ready(function()
{

$(document).delegate('.vote, .vote1', 'click', function()
    {
...

Upvotes: 0

Vince V.
Vince V.

Reputation: 3143

You need a backend that gives the information back in a format (like JSON or XML) and then parse it into the page. When they click the vote link there happens a ajax request to vote. And the response of this ajax request is your new question.

Then you parse the request, replace your old question with the new one. And replace your ajax request URL with the new ID of the new question. (so you can vote always again)

Upvotes: 1

Related Questions