JQuery:拇指向上和向下评级系统?

我想在我的网络应用程序中使用jquery实现拇指向上和向下评级系统。 请告诉我一些插件或代码如何在我的网站上实现拇指向上和向下评级系统,请分享链接或资源。

谢谢

jQuery的

这只是一个翻转效果,以及等待更新数据库条目的地址。 它不是真正的jQuery。 这种“肉”将是您的数据库和服务器端脚本。

$("a.voteup").click(function(){ $.get("updatescore.php", {"id":"112","score":"1"}, function(response){ /* Do something with the response */ }); }); 

那段代码可能有些偏差,但它足够接近传达这一点。 从那里,您将有一个服务器端脚本等待接收:

PHP / MySQL

重要提示:请勿使用原样。 仅用于演示。
ASP.NET:我从你过去的问题中注意到你可能在.NET技术中工作。 这里完成的过程仍然会非常相似。 您将处理传入的请求,要求用户登录,他们的分数为1或-1,以及您希望的任何其他内容。

  session_start(); $userid = $_SESSION["userid"]; $vote = $_GET["score"]; /* Limit to 1 or -1 */ $article = $_GET["id"]; /* Whatever is printed here will be the 'response' variable over in our jQuery callback function. Ideally, this function would only allow the vote if the following are true: 1. User has not yet voted on this article 2. Score is 1 or -1 3. Voting is enabled on this article 4. User is indeed logged in */ print castVote($article, $vote, $userid); ?> 

这是一个使用JQuery与PHP / MySQL中的后端竖起大拇指的风格。

链接到代码 (您可以在线尝试演示,所有源代码都在那里)

只需阅读Jquery的文档:

给我评分:使用Ajax

http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery