[jQuery] finding <script> tags in remote HTML

[jQuery] finding <script> tags in remote HTML


Hi all. I'm having an amazing amount of pain trying to parse and
execute JS script blocks in remote HTML (in IE, typically).
Here's the code in question:
$.ajax({
    type:         "POST",
    url:         checkFilename,
    dataType:     "text",
    success:     function(src){
        var wtf = $(src).find("script").each(function(){
            eval( $(this).text() );
        });
    }
});
http://www.pastie.org/308878
checkFilename is just an HTML file, so src comes back with the entire
source of that page. What I want to do then is use find() to get all
inline <script> tags inside the body of the page, and use eval()* to
run them. Elsewhere before this happens a large chunk of HTML from
checkFilename is loaded and displayed, and now I need to run any
inline JS that was in the page.
The above function works perfectly in FF2 and FF3, but IE completely
fails to find any instances of <script> tags in src. Any ideas? I
can't extract the inline JS blocks in question, as they are dynamic
and inserted by a CMS that I have no control over.
Thanks in advance,
--Clive.
* I know it's evil, but I need it in this instance...