Well I'm here with a problem that is the following I have a lop while
that shows me all users and in each has a follow button I'm doing via ajax when clicking on next change the text not to follow and the color of the button and this is working only that when I click next it puts me not follow in all that are in the while how can I solve this?
Jquery
<script>
$(document).ready(function(){
$(".seguir_user").click(function() {
var seguidores = {
follower: $(this).closest('input#follower').val();
followed: $(this).closest('input#followed').val();
}
$(this).addClass("seguir_user_click");
$(this).text("A Seguir")
$.ajax({
type: "POST",
url: "ajax/processa_seguidores.php",
data: seguidores,
cache: true,
success: function(seguidores){
$("#sucesso").html("sucesso").fadeIn(400);
$("#sucesso").fadeOut(4000);
}
});
return false;
});
});
</script>
HTML
$result_foodies=mysql_query("SELECT * from users_social order by id desc limit 9");
while($row_foodies=mysql_fetch_object($result_foodies)){
$result_count = mysql_query("SELECT COUNT(*) AS id FROM posts where user_id='".$row_foodies->id."'") or
die(mysql_error());
$bar = mysql_fetch_array($result_count);
?>
<form action="" id="seguidores" name="seguidores">
<input type="hidden" id="follower" name="follower" value="<?php echo $_SESSION['user_id']; ?>">
<input type="hidden" id="followed" name="followed" value="<?php echo $row_foodies->id; ?>">
<div class="my_account user wow fadeInLeft">
<figure>
<a href="users/<?php echo $row_foodies->slug; ?>"><img style=" border-top-left-radius:10px; border-top-right-radius:10px;" src="<?php echo $row_foodies->user_foto; ?>" alt="" /></a>
</figure>
<div class="container_user" style="border-bottom-left-radius:10px; border-bottom-right-radius:10px;">
<p><?php echo utf8_encode(limita_caracteres($row_foodies->fb_nome, 13, false)); ?></p>
<div style="font-family:Arial, Helvetica, sans-serif; margin-top:-15px; font-size:13px; color:#999;"><?php echo $bar['id']; ?> Opiniões</div>
<div style="font-family:Arial, Helvetica, sans-serif; margin:0px 0px 10px 0px; font-size:13px; color:#999;">0 Seguidores</div>
<?php
if($_SESSION['FBID'] || $_SESSION['user_id']){
?>
<div class="seguir_user" style="margin:0px 0px 15px 0px;">Seguir</div>
<?php
}
?>
</div>
</form>
</div>
<?php
}
?>