Using jQuery 1.4 I've come across an issue with external JS in an ajax response being removed when accessing it using html()
.
I'm creating an endless scrolling effect for a tumblr theme using an ajax request to load the next page. Tumblr outputs JS in audio and slideshow posts to render <embed>
elements (Flash players) to show the content. The markup cannot be changed.
Everything works fine using jQuery 1.3.2, the external JS is executed and renders the players, however in 1.4 the javascript is removed and I'm left with the fallback text. The JS is included in the response, but when using html()
within the ajax callback I can't retrieve or get the javascript to execute.
I want to use jQuery 1.4 because I'm using some of it's new features in other parts, I can get it to work using split
but I'm not sure how reliable it is to split the response on a specific string.
I've prepared a basic sample (includes 2 files, test.html & request.html) demonstrating the issue. Open test.html to load a local request from request.html
Is this behaviour deliberate, can I get around it, or am I just doing it wrong?