JQuery的:拇指向上和向下的评价体系? [英] JQuery: Thumbs up and down rating system?

查看:89
本文介绍了JQuery的:拇指向上和向下的评价体系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要实现的拇指向上和向下评级系统在我的web应用程序使用jQuery。请告诉我一些插件或code如何实现拇指向上和向下评级系统在我的网站,欢迎分享链接或资源。

I'm want to implement thumbs up and down rating system in my web app using jquery. Please tell me some plug-in or code how to implement the thumbs up and down rating system in my website, please share links or resources.

感谢

推荐答案

这无非是一个翻转效果,以及等待更新数据库条目的地址。这不是真正的jQuery。这样做的肉将是你的数据库和服务器端脚本。

jQuery

This is nothing more than a roll-over effect, and an address that waits to update a database entry. It's not really jQuery. The "meat" of this would be your database and server-side scripting.

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

这code可能有点过,但它足够接近传达点。从那里,你将有一个服务器端脚本等待接收这样的:

That code may be a bit off, but it's close enough to convey the point. From there, you would have a server-side script waiting to receive this:

重要提示:不要使用原样。仅用于演示。
ASP.NET:我从你过去的问题,发现你很可能是内部的.NET技术工作。在这里完成这个过程仍然会faily相似。你会处理传入的请求,要求用户登录,他们的成绩为1或-1,并且你希望任何其他。     

IMPORTANT: Do not use as-is. Only for demonstration.
ASP.NET: I noticed from your past questions you are likely working within the .NET technologies. The process done here will still be faily similar. You'll handle the incoming request, require the user to be logged in, their score to be 1 or -1, and whatever else you wish.

  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的:拇指向上和向下的评价体系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆