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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:48:31+00:00 2026-05-11T11:48:31+00:00

I have a page with a dropdown. The onchange event calls a Javascript function

  • 0

I have a page with a dropdown. The onchange event calls a Javascript function (below) that includes an Ajax block that retrieves data and populates a TEXTAREA. On the surface, everything works.

I can select any item in the list with no problems. However, if I select an item that has previously been selected, the Ajax call appears to hang. It looks like maybe some weird caching issue or something. If I close the browser and reload the page, all items work again until I re-select.

I’ve tested for the readyState and status properties when it’s hanging, but I get nothing. Am I missing something?

The page is a client project behind authentication so I can’t post a URL, but here’s the Ajax code. This is in a PHP page, but there’s no PHP script related to this.

function getText( id ) { var txt = document.getElementById( 'MyText' );  txt.disabled = 'disabled'; txt.innerText = ''; txt.className = 'busy';  var oRequest = zXmlHttp.createRequest(); oRequest.open( 'get', 'get_text.php?id=' + id, true ); oRequest.send( null );  oRequest.onreadystatechange = function() {     if( oRequest.readyState == 4 ) {         if( oRequest.status == 200 ) {             txt.innerText = oRequest.responseText;         } else {             txt.innerText = oRequest.status + ': ' + oRequest.statusText;            }          txt.disabled = '';         txt.className = '';          oRequest = null;     } }} 

Edit: The code block seems a little quirky; it won’t let me include the final } unless it’s on the same line as the previous.

  • 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. 2026-05-11T11:48:32+00:00Added an answer on May 11, 2026 at 11:48 am

    You’re setting the onreadystatechange function after you’re sending the request. If it takes a long time (ie if it goes to the server), this will probably work, since there will be a delay before it tries to call the callback.

    If the page is cached, though, the browser is probably trying to call onreadystatechange immediately in the send method. Move your assignment to onreadystatechange to before the open/send code.

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

Sidebar

Ask A Question

Stats

  • Questions 141k
  • Answers 141k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer First question, why are the databases set to Auto Close?… May 12, 2026 at 8:08 am
  • Editorial Team
    Editorial Team added an answer use database_name Sp_help table_name This stored procedure gives all the… May 12, 2026 at 8:08 am
  • Editorial Team
    Editorial Team added an answer If it is sufficient to determine whether or not a… May 12, 2026 at 8:08 am

Related Questions

I'm building a recipe-finder for a new food blog. The design I have basically
I've never used AJAX and am, quite frankly, not much versed in JS either.
I have a website where the user requires to add and remove Headlines from
I'm using CakePHP for a small web app and on one form page there's

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.