If the javascript you are calling is a function that returns a value, you should be able to capture the return value the same as you would in a local function call.
HTML Code:
<!-- Include the Javascript containing the target function -->
<script type="text/javascript" src="http://remoteserver/remote.js"></script>
<script type="text/javascript">
// Set the variable to be passed to the remote function
var key="x";
// Call the remote function, and store the return value in another variable
var value = remoteFunction(key);
</script>
And for those of you that are wondering, yes, to bbb.com, this would be an exploit of a cross site scripting vulnerability. Javascript bad.