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

  • Home
  • SEARCH
  • 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 9186927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:38:58+00:00 2026-06-17T19:38:58+00:00

I have a home.php page that has a button to invoke an ajax call

  • 0

I have a home.php page that has a button to invoke an ajax call to replace the contents of an element

$(document).ready(function() {
    $("#button").click(function() {
         $ajax(...).done(function(response) { $("#home-cabinet").html(response) });
    });
});

There are some HTML elements in the ajax response that I would also like to bind some event handlers. But the problem is I don’t know the content of response, so I cannot stick the jQuery element selector code inside .done().

It makes more sense if I can let the response set up the handlers itself. How can I do that?

  • 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-17T19:38:59+00:00Added an answer on June 17, 2026 at 7:38 pm

    Add to the response data

    <input type="button" id="newElement" />
    ...
    ...
    <script>
        $('#newElement').on('something', function(){});
    </script>
    

    Just note that the DOM ready event doesn’t fire on ajax requests, so make sure the <script> is written after the element.

    But the problem is I don’t know the content of response

    You should know what you’re going to get, it’s your domain you’re requesting… anyway the above should work just fine.

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

Sidebar

Related Questions

I have this page, let's call it index.php index.php has a list of users
I have a like/send button that I've set up on a customer's home page.
I have a home-screen widget that has an icon that starts/so pose to bring
I have a php page that runs on a local uri on a local
I have built a site that uses an index page which has a containing
Hi I have a website's home page that I am reading in using Curl
I have a php page that uses php sessions as well as jquery to
I have an HTML page (PHP, really) with a table cell that contains a
I m developing a php site for mobile phones. It's home page has images
I have an archive page template that I've built that has a successful navigation

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.