More than one year ago I was playing with AJAX, and I was facing a problem with scripts contained in documents loaded through XMLHttpRequest. So, at that time, I wrote two blog posts talking about this issue. The first was just a modify to the well known AHAH technique, while the second post was a script I entirely wrote by myself: “Javascript script execution in innerHTML: the revenge”.
Now more than a year has passed and technologies are evolved. Now the web is full of very powerful AJAX frameworks and much probably, for medium/big projects you won’t need this kind of “hack” anymore. But there are few developers across the world that still hand-code their little ajax tricks and needs this. So, since I received a lot of comments about that, I’m writing here again to update you about the modifies that have been done to that script.
That script suffered of a (relatively) big problem: if you had a document.write() call in the external script you loaded, well, it won’t work. Jeremy Bell has modified that script in order to have this functionality included. You can see it working at http://www.blackoutwebdesign.com/ajax.demo.php.
For other discussion about the topic, look at the comments in the post, they have been very helpful to me to correct various compatibility issues.