In my friends page, when you accept a user, it sends a ajax call:
function MeYouFriendNB(confirm){
var c = confirm ? 'confirm' : 'ignore';
var fID = $('.fID').val();
$.ajax({
type: "POST",
url: "misc/AddFriend.php",
data: {
mode: 'ajax',
friend: c,
uID : $('#uID'+fID).val(),
fID : $('#fID'+fID).val(),
bID : $('#bID'+fID).val()
},
success: function(msg){
$('#friend'+fID).slideUp('slow');
$('#Friendlist').prepend(msg);
$('#theNewFriend').slideDown('slow');
}
});
}
On each friend request, there's a link to the function:
<?php
while($showW = mysql_fetch_array($friendsWaiting)){
echo "<div id='friend".$showW['id']."' style='position: relative; background: #3a5f6e;'>";
?>
<input type="hidden" name="fID" class="fID" value="<? echo $sInfo["id"]; ?>">
<input type="hidden" name="uID" id="uID<? echo $showW["id"]; ?>" value="<? echo $sid; ?>">
<input type="hidden" name="fID" id="fID<? echo $showW["id"]; ?>" value="<? echo $showW["id"]; ?>">
<input type="hidden" name="bID" id="bID<? echo $showW["id"]; ?>" value="<? echo $showW["bID"]; ?>">
<?php
echo "<div style='position: absolute; top: 15px; right: 105px;'>
<a href='javascript:void(0);' onclick='MeYouFriendNB(true);' style=' margin-right: 45px; color: #FFF;'>Bekräfta</a>
<a href='javascript:void(0);' onclick='MeYouFriendNB(false);' style='color: #ccc;'>Ignorera</a></div>";
}
?>
But everytime it sends the ajax call, it gives same fID, bID and uID, to every friendrequest. So e.g if i have 5 friend request, them all have same fID, uID and bID.
As you can see i tried to make the bID and uID and fID´s id unique by adding <? echo $showW["id"]; ?> to the id´s fID, uID and bID, and in the function, i made a var fID that checks class .fID for the id, that they all have... but this didnt work out, it still send the same ids to the ajax call
Hope you can help me