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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:55:51+00:00 2026-06-09T14:55:51+00:00

For the last few hours, I’ve been trying to use jQuery append() to append

  • 0

For the last few hours, I’ve been trying to use jQuery append() to append content from an XHR responseText into a div element (with an ID).

I have verified that I am getting the responseText back, all variables are correct, etc. I believe it has something to do with the attempt to append the responseText, which is HTML.

function fetchasyncClientData_Handler() {
    if (asyncajaxrequest.readyState==4 && asyncajaxrequest.status==200){
        $("#clientList").append(asyncajaxrequest.responseText);
    }
}

lastClientID = $("#clientList_Row input").last().val();

asyncajaxrequest = new XMLHttpRequest();
asyncajaxrequest.onreadystatechange = fetchasyncClientData_Handler();
asyncajaxrequest.open("GET", "fetchLatestClientList.php?id=" + lastClientID);
asyncajaxrequest.send();

Any ideas on what the issue may be? I do not want to use the jQuery.ajax() library / functions, might I mention.

  • 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-09T14:55:52+00:00Added an answer on June 9, 2026 at 2:55 pm

    You should pass the request on to the fetchasyncClientData_Handler function, and to do so you need to call the function with parenthesis, which you would do in a seperate function call on the readystate event, and that will let you check if the request succeeded before calling the fetchasyncClientData_Handler function :

    function fetchasyncClientData_Handler(req) {
        $("#clientList").append(req.responseText);
    }
    
    var lastClientID = $("#clientList_Row input").last().val();
    
    var asyncajaxrequest = new XMLHttpRequest();
        asyncajaxrequest.onreadystatechange = function() {
            if (asyncajaxrequest.readyState==4 && asyncajaxrequest.status==200){
                fetchasyncClientData_Handler(asyncajaxrequest);
            }
        }
        asyncajaxrequest.open("GET", "fetchLatestClientList.php?id=" + lastClientID);
        asyncajaxrequest.send();
    ​
    

    You could just try calling the function like so instead :

    asyncajaxrequest.onreadystatechange = fetchasyncClientData_Handler;
    

    with the code you have, as all your variables are global anyway.

    Whenever you write the function with the parenthesis you execute the function.

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

Sidebar

Related Questions

I've been trying over the last few hours to implement a jQuery easing effect
I have been trying to remove this Firebug Console Error from last few hours.
I've been spending the last few hours trying to find the memory leak in
For the last few hours I've been trying to set up this http://code.google.com/apis/books/docs/dynamic-links.html on
I have been struggling for the last few hours trying to get this search
I am having this array. Last few hours I have been trying to loop
I've been pulling my hair out for the last few hours trying to wrestle
I have been trying for the last few hours to get a UIAlert with
I've been pulling my hair for the last few hours trying to figure out
I have been trying to get jquery.autocomplete (http://docs.jquery.com/Plugins/autocomplete) to work for the last few

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.