Hi

if you get the response text and put it somewhere in a page in a the
onComplete function, the next line might call a function in there that calls
the rest. It won't execute automatically.
also you can put the response in a document.createElement("IFRAME").src,
than it actually will execute.

Huub



On 8/13/07, starmonkey <[EMAIL PROTECTED]> wrote:
>
>
> I'm using jQuery's load() function in order to pull content from the
> server and stick it into a div.
>
> This content has both html + javascript inside it, and I need to get
> the javascript actually evaluated for IE6+7.
>
> Firefox handles javascript fine for both inline + externally
> referenced libraries, eg:
>
> <script language="javascript" src="/path/to/lib.js" type="text/
> javascript"></script>
>
> and
>
> <script language="javascript">
>        alert('some js code running here!');
> </script>
>
> The above does not work with both IE6 + IE7.
>
> If you look at mootools' api, they include a "evalScripts" flag to
> eval/execute javascript inside the returned content:
>
> http://docs.mootools.net/Remote/Ajax.js
>
> They make use of IE's "execScript" function in order to do this.
> Sample code:
>
> onComplete:
> -----
> scripts = (this.options.evalScripts) ? '' : null;
> this.response.text = this.response.text.replace(/<script[^>]*>([\s
> \S]*?)<\/script>/gi, function(){
> if (scripts !== null) scripts += arguments[1] + '\n';
> return '';
> });
>
> if (scripts) (window.execScript) ? window.execScript(scripts) :
> window.setTimeout(scripts, 0);
> -----
>
> Another blog entry about execScript:
>
> http://ajaxian.com/archives/evaling-with-ies-windowexecscript
>
> Questions:
> * Is there a way to handle this neatly with jQuery?
> * Is an "evalScripts" flag planned for jQuery's load() function?
> * Is there a better way to handle content containing javascript?
>
> thanks in advance,
> SM
>
>

Reply via email to