I have this friend request page, and i want my div
echo "<div style=' font-weight: bold; background: #283b43; border-bottom: 1px dashed #719dab;'>";
echo "<img src='images/NewFriend_small.png' style='float: left; margin-left: 25px; margin-right: 10px;'>";
echo "Friend requests";
echo "</div>";
To disappear too if it's the last friend request the user have. Right now it doesnt do it, and only slide up the actual request (username, picture and so)
How should i check for if its the last friendrequest?
Right now its my code is like this
$开发者_如何学编程friendsWaiting = mysql_query("SELECT * FROM users_friends where uID = '$v[id]' AND type = 'friend' AND accepted = '0'");
while($showW = mysql_fetch_array($friendsWaiting)){
echo "id: $showU[bID]";
}
JS when they accept/deny friend:
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').val(),
fID : $('#fID').val(),
bID : $('#bID').val()
},
success: function(msg){
$('#friend'+fID).slideUp('slow');
$('#Friendlist').prepend(msg);
$('#theNewFriend').slideDown('slow');
}
});
}
Use the :last selector in jQuery
http://api.jquery.com/last-selector/
$('div.friend:last').slideUp();
Is that what you were looking for?
精彩评论