onreadystatechange event problems

T

Tim Streater

In my app, the browser is making ajax calls to various PHP scripts. This
is all happening on one host, mediated by a local instance of apache
that is configured to respond only to localhost requests. Ordinarily,
this all works fine.

Recently I've noticed the app working poorly because of, the browser
claims, 404 responses to requests for some scripts. Since these scripts
*do* exist, I view this as a symptom of another problem, but in the
meantime I want my app to notice these failures, clean up, and put a
note in the log. That way I can at least see if the problem correlates
with something.

To implement this approach, the callback function now also gets called
if I have readyState==4 and status!=200. All the callback functions are
now set to see this and clean up, etc.

Now my problem is this: if I rename one of the scripts for testing
purposes, to force a 404, I don't see *any* onreadystatechange events -
the request.onreadystatechange function is not getting called. I've
tested this with a tiny example using code extracted from the app, and
there, it works as expected.

Any suggestions as to circumstances under which onreadystatechange
events don't occur when expected would be appreciated.
 
D

Denis McMahon

To implement this approach, the callback function now also gets called
if I have readyState==4 and status!=200. All the callback functions are
now set to see this and clean up, etc.
Now my problem is this: if I rename one of the scripts for testing
purposes, to force a 404, I don't see *any* onreadystatechange events -
the request.onreadystatechange function is not getting called. I've
tested this with a tiny example using code extracted from the app, and
there, it works as expected.

The first thought that comes to mind is that you're not checking what you
think you're checking.

Check spellings, names, case is correct.

Rgds

Denis McMahon
 
T

Tim Streater

Stefan Weiss said:
I assume that all the XHR requests are sent to your Apache server (not
to local files), and that the pages from which the requests are sent are
also loaded from the same server- same name, same port, same protocol?

It turns out that this was another manifestation of the issue I was
trying to recover from; there was a phantom remote mount that was
evidently wedging some part of the filesystem. This was enough to cause
problems in apparently unrelated areas. A couple of restarts fixed it.

Still, my code is the more robust now so that can't be bad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top