If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Take this with a grain of salt, as I have not pasted and tried to replicate your code, but I suspect that the problem is that the 'alert' gives the time for the AJAX request to complete. You might try adding after :

Code:

function setOutput13(imgID){

a line like this:

Code:

if (httpObject.readyState != 4){return;}

and omitting the alert--and really, you should be checking the status of the httpObject as well.

I added a simple delay to the first function which is basically delaying the javascript from processing the the last command in the AJAX function which process the the output based on the status of --httpObject.readyState--

as the code is shown above the alert generates a value of 1, then then next statement is processed which by now it is a 4 and the generated out is inserted correctly and the function works as I suspect it does. The delay I inserted shows up as a delay before the alert window which is what I expect.

IF I take out the alert statement the function fails to complete as the value of --httpObject.readyState-- is 1. In the following block of code I checked the value of --httpObject.readyState-- in the output function and it loops with a value of 1

I placed the check after the initial check of the value which fails (it is looking for a 4 but is at that point a 1)

The key seems to be a the alert statement and how that is processed in that the processing of the alert statement is allowing the --httpObject.readyState-- to change to a 4 and let the function process successfully

I do not think I understand how or when --httpObject.readyState-- gets altered but somehow the alert is allowing it to work.

I also use identical functions many times prior in my code with one small exception they all work perfectly the difference is in the last line of the first function called

Code:

httpObject.onreadystatechange = setOutput13(imgID);

in the code below from a working function I am not passing anything to the output processing function.

Code:

httpObject.onreadystatechange = setOutput11;

I will try to create a global variable and maybe set it in the first function and then read the global in the second that way I do not have to pass the variable and it may work I will let you know what I find but this is an interesting issue.