Login Register

Running scripts in returned content

Hi everyone,

I'm using Struts 2 in my project. It comes bundled with it's own dojo-based tag library. Unfortunately it's still using 0.4.

I'm using dojo to replace some content in the page, like so:

var dojoRequest = dojo.io.bind({
                url: url,
                load: function(type, data, event) {
                          element.innerHTML = data;
                          toggleLoaded(element, indicator);
                      },
                error: function(type, data, event) {
                          element.innerHTML = myAjaxLib.ajaxFetchError;
              toggleLoaded(element, indicator);
                      },
                mimetype: "text/html"
        });

What I want to know is this: are there any convenience methods in dojo for executing scripts in returned data? I'm not eager to do so, but at some point I may need it for certain widgets to function. Parsing through data, looking for content inside script tags, and executing with eval is of course possible, but it's a lot of trouble and sounds like something that should be possible to do more easily.

I also have prototype and script.acu.lous included in my project, but I don't know much about them; if you know of something in them to execute scripts in the data, please tell me.