I'm writing an Ubiquity command and I want to pull in some remote HTML/ Javascript. The code I currently have is like so:
var doc = CmdUtils.getDocument(); var url = "http://my-remote-url"; jQuery.get(url, function(data) { jQuery(doc.body).append(data); }); The problem is that the javascript within data gets evaluated within the global scope (using jQuery.globalEval), but the CmdUtils object isn't available in the global scope and I'd like to be able to use it in my remote script. Is there any way that I can get jQuery (or perhaps do it without jQuery) to evaluate the returned javascript within the current scope, so that it has access to CmdUtils and the other variables that are defined within that scope? If not are there any alternative way in which I can pass the CmdUtils object to the remote script? Thanks in advance! Ben