> > > 1. Removing all line breaks from the script and writing " > response.js(script)" in the plugin controller. Again no luck. > > Actually, this should work, but the syntax is:
response.js = '''<script>$(function() {$(".replacewloading").click(function() {$(this).parent().html('<span><img src="static/plugin_test/images/loading.gif"/>Refreshing...</span>')} );} );</script>''' > 1. Including the script directly into the view html via the view and > controller. This is the case where the script seems to disappear. When I > inspect the html using Firebug, there's no trace of it. It also leaves > open > the question of how it will get executed when the component is finished > loading. It turns out that this is the working solution. The script > doesn't disappear, it can be found in jquery.js/eval/seq. I'm not > knowledgable about javascript/jquery so I have no idea where that actually > is. It isn't part of the filesystem. Some sort of virtual client-side > storage perhaps? I'm still not sure why it wasn't working earlier, perhaps > I made a syntax error somewhere. > > As far as I understand, if you insert a <script> tag into the DOM, it won't execute. However, when jQuery receives an html response via ajax, it automatically handles the execution of any script tags in the html, though I guess you won't see the script itself in the DOM where you expect it. Anthony