>
> Whenever you .load() html the incoming scripts are automatically
> evaluated. To make that happen with $.ajax() you need to specify the
> dataType property. If you want HTML to come back with embedded
> <script> tags, specify it as 'html'. If you're returning nothing but
> executable JavaScript, use 'script'.
>
> More info here:
> http://jquery.com/api/
>
> Example:
>
> $.ajax({
> url: url,
> type: "POST",
> dataType: "html",
> success: function(html) {
> // in the SVN version of jQuery html == the returned HTML
> // in every other version you need to do this instead:
> // html = $.httpData( html, 'html' )
> }
> });
The only way it worked for me with having scripts evaluated was using
$.load...
It's because the following lines are only located in the load function:
// Execute all the scripts inside of the newly-injected HTML
$("script", self).each(function(){
if ( this.src )
$.getScript( this.src );
else
eval.call( window, this.text ||
this.textContent || this.innerHTML
|| "" );
});
I think Jörn has already created a ticket for this.
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/