我只希望注册用户进行投票。我不想改变我的所有代码。现在最简单的方法就是将用户登录并将其传递给隐藏域。如何通过AJAX后发送隐藏值
我怎样才能在这里传递一个隐藏的值?
这是我迄今为止
$(function() {
$(".vote").click(function()
{
var name = $(this).attr("name");
var id = $(this).attr("id");
var dataString = 'id='+ id ;
var parent = $(this);
if(name=='up')
{
$(this).fadeIn(200).html('<img src="dot.gif" align="absmiddle">');
$.ajax({
type: "POST",
url: "up_vote.php",
data: dataString,
cache: false,
success: function(html)
{
parent.html(html);
} });
}
return false;
});
});
<div class="box1">
<div class="up"><a href="" class="vote" name="up" id="'.$row['id'].'">'.$row['plus'].'</a></div>
</div>
up_vote.php
if($_POST['id'])
{
$id=$_POST['id'];
.
.
.
}
为什么没有PHP中检查和如果用户没有登录不呼应投票禁用投票? – stedotmartin 2012-01-02 00:49:20
我必须更改太多的代码。我不能只是停止投票。 – emre 2012-01-02 00:54:08
哦,意大利面条代码[PHP]的乐趣:-) – 2012-01-02 01:49:09