Eğer bir kullanıcı kabul benim arkadaşlarım sayfasında, bir ajax çağrısı gönderir:
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');
}
});
}
Her arkadaşlık isteği üzerine, işlevine bir bağlantı var:
<?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>";
}
?>
Ama her şey o ajax çağrısı gönderir, her friendrequest için, aynı FID, teklif ve UID verir. Ben 5 arkadaş isteği var ise örneğin, hepsini aynı FID, UID ve teklif var.
Gördüğünüz gibi FID i id nin FID, UID ve teklife <? echo $showW["id"]; ?> ekleyerek teklifi ve UID ve Fid id benzersiz yapmak için çalıştı, ve fonksiyonu, ben bir var yapılan kontroller sınıf. id FID, hepsi var ... ama bu işe yaramadı, hala ajax çağrısı aynı kimlikleri gönderin
Bana yardımcı olabilir umuyoruz