Alert "fixing" problems?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • moho
    New Member
    • Mar 2007
    • 21

    Alert "fixing" problems?

    Hi, I've been struggling with AJAX for a while and notice that if I add the alert("xxx")
    in my code it always makes the code work.

    I'm using divs where I put the output from the server and then handling the info from there. Sometimes the JS doesn't find the newly inserted tags (divs with id), only when I add the alert command before it. It's kind of strange. Aswell as when enabling FireBug. So I guess that FireBug and the alert are doing the same things. Any clues somebody?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    This is usually caused when not waiting for the response. What the alert does is allow time for the response to be received from the server. All code depending on the response should be called from the callback function when the readyState is 4 and status is 200.

    Comment

    Working...