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 8318627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:02:29+00:00 2026-06-08T22:02:29+00:00

When the page loads I have an initial replaceWith that runs the following code:

  • 0

When the page loads I have an initial replaceWith that runs the following code:

<span id="requestAlert>"
    <span class="font1">wants to be your friend&nbsp;</span>
    <input type="submit" id="acceptRequest" value="Accept" style="width: 60px; 
           height: 28px" class="button1" />&nbsp;
    <input type="submit" id="denyRequest" value="Deny" style="width: 50px; 
           height: 28px" class="button1" />
</span>

Then I have the following code that is suppose to manipulate the code above when the page is finished loading:

$("#acceptFriend").live('click', function() {
   acceptFriend();
});

function acceptFriend() {
    var targetedUserId = $(document).getUrlParam("id");
    jQuery.ajax({
        type: "POST",
        dataType: "JSON",
        url: "<?=base_url()?>index.php/regUserDash/acceptFriend",
        data: { targetedUserId: targetedUserId },
        json: {acceptFriendSuccess: true},
        success: function(data) {
          if(data.acceptFriendSuccess == true) {
            $("#requestAlert").replaceWith('<span class="font1">You two are noe friends</span>');
          }
        }
    });
}

I cannot seem to get the above code to manipulate the initial replaceWith code. I thought maybe .live() would do the trick but apparently not. Any ideas as to why it won’t worK? Any solutions?

  • 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-06-08T22:02:30+00:00Added an answer on June 8, 2026 at 10:02 pm

    Your input has the id acceptRequest while your jQuery has the id acceptFriend.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this jQuery tooltip that works fine on initial page loads. The problem
I have a <ul> that is populated with javascript after the initial page load.
I have an html page that open a popup window when the page loads.
I have a website that requires a very large background image. The page loads
I have a page that loads content through AJAX. Among this content are some
I have an aspx page that dynamically loads user controls: there is an UpdatePanel
I have tab in a web page that loads and displays another page dynamically,
I have a form which has three inputs when the page loads -- 2
I have a stripes action page. and When the page loads, I want to
I'm trying to have a site set up so when the page loads there

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.