开发者

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 li开发者_C百科nk, I must update the 2 boxes showing a new question without reloading the page.

This is before I vote:

PHP and MySQL voting system with jQuery

And after I vote:

PHP and MySQL voting system with jQuery

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


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)


My problem resolved in other post:

$(document).ready(function()
{

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜