As many others have already noted, if your page makes an AJAX call
that returns javascript and HTML, for some reason IE and Safari are
unwilling to execute any of the javascript.  Looking through the
jQuery code, I noticed that there *used* to be an evalScripts function
in the same object as the load function, but that is deprecated in
light of the fact that there is now a globalEval function that should
be called with certain of the the HTML injection methods.  However,
after numerous tests, it seems that this wasn't working all the time
in either Safari or IE.  I dediced to add the evalScripts function
back in like so:

        evalScripts: function( self ){
                var scripts = self.get(0).getElementsByTagName( 'script' );
                $(scripts).each(function(){
                        if ( window.execScript ) {
                                window.execScript( $(this).html() );
                        }
                        else if ( jQuery.browser.safari ) {
                                window.setTimeout( $(this).html(), 0 );
                        }
                        else {
                                eval.call( window, $(this).html() );
                        }
                });
        }

This gets called by load if the oncomplete status is "success" with:

        self.evalScripts( self );

Can anyone tell me if this is a bad idea (and if so, why?) as well as
any insights into why the built in globalEval function doesn't always
work in IE or Safari?

Reply via email to