Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1026479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:05:22+00:00 2026-05-16T12:05:22+00:00

In my friends page, when you accept a user, it sends a ajax call:

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T12:05:23+00:00Added an answer on May 16, 2026 at 12:05 pm

    I would do it like this: (not sure if this solves your problem though)

    Javascript:

    function MeYouFriendNB(confirm, uID, fID, bID){
        var c = confirm ? 'confirm' : 'ignore';
    
        $.ajax({ 
            type: "POST",
            url: "misc/AddFriend.php",
            data: {
                mode: 'ajax',
                friend: c,
                uID: uID,
                fID: fID,
                bID: bID
            },
            success: function(msg){
                $('#friend'+fID).slideUp('slow');
                $('#Friendlist').prepend(msg);
                $('#theNewFriend').slideDown('slow');
            }
        });
    }
    

    PHP:

    <?php while($showW = mysql_fetch_array($friendsWaiting)): ?>
        <div id="friend<?php echo $showW['id']; ?>" style="position: relative; background: #3a5f6e;">
            <div style="position: absolute; top: 15px; right: 105px;">
                <a href="javascript:void(0);" onclick="MeYouFriendNB(true, <?php echo $showW["id"]; ?>, <?php echo $showW["bID"]; ?>, <?php echo $sid; ?>);" style="margin-right: 45px; color: #FFF;">Bekräfta</a>
                <a href="javascript:void(0);" onclick="MeYouFriendNB(false, <?php echo $showW["id"]; ?>, <?php echo $showW["bID"]; ?>, <?php echo $sid; ?>);" style="color: #ccc;">Ignorera</a>
            </div>
        </div>
    <?php endwhile; ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find out if friends of a user have liked a page
hi friends i have i am showing some data via ajax on my page
Alright, so a content page uses this: $tab = Friends; $title = User Profile;
hi friends i'm creating a php page to import the data from a csv
I know you can invite friends to your Facebook Fan Page via Admin Panel
Hello Friends check my code http://jsfiddle.net/sUaky/2/ i want to load a web page in
I can send requests to friends using Multi Friend Request Selector inside my Page
Cant find the way to display friends, who achieve it, on achievement page. /USER_ID/achievements
Friends, My apex page has several different radio groups, each one can have the
friends, i have a page on which i am displaying image from gallery then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.