This is tricky to do correctly in a cross-browser manner and is one of the very many reasons that I recommend adopting a well-written JavaScript library such as Prototype or jQuery to handle your Ajax needs. Prototype has an option that specifies that script elements returned in the Ajax response are to be evaluated. jQuery does it automatically.