views:

301

answers:

5

Is it normal to have a short delay after .innerHTML = xmlhttp.responseText; ?

Delay aproxamilty 1 sec. after xmlhttp.readyState==4.

Using firefox 3.0.10

A: 

Do you have firebug installed? If not, install that from here (https://addons.mozilla.org/en-US/firefox/addon/1843) and enable the console and script and then you'll be able to see when the responseText is returned. But generally, yes its normal to have a short delay while the request is being made.

Christian
A: 

how are you doing the timing to verify the difference? (console dump?)

Some delay is unavoidable as innerHTML (or DOM manipulation, for that matter, as well) requires the browser to interpret and process and display the changes. Certainly, depending on the size of the change, this could take 1 sec.

Jonathan Fingland
A: 

No, this sounds like you may have some malformed or large response.

The browser will parse the responsetext and construct nodes in the DOM. This is typically very fast in Firefox.

Perhaps you could describe your circumstances and response text a little more and it would help us debug.

Jeff Meatball Yang
A: 

usually i don't see that behavior. you can put some sample code here, or try

http://www.0011.com/ajax_example

and see if you see the same behavior as your code.

動靜能量
A: 

I experience something similar. What if I am loading a flash game into a div using innerHTML? The code inserted into the div is relatively small, but the flash file is a few Mb in size. Should the size of the file effect the delay?