Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax call not responding on repeated request
    text
    copied!<p>I have a page with a dropdown. The <code>onchange</code> event calls a Javascript function (below) that includes an Ajax block that retrieves data and populates a <code>TEXTAREA</code>. On the surface, everything works.</p> <p>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.</p> <p>I've tested for the <code>readyState</code> and <code>status</code> properties when it's hanging, but I get nothing. Am I missing something?</p> <p>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.</p> <pre><code>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; } }} </code></pre> <p><em>Edit:</em> The code block seems a little quirky; it won't let me include the final <code>}</code> unless it's on the same line as the previous.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload