Question: I'm using struts2 and have this code that triggers after an action is performed (via Ajax):

```
    dojo.event.topic.subscribe("cambioProyecto", function() {
            var hola = json_entregables;
            alert("hola");
    }

```

The \*json\_entregables\* variable is a parameter given via struts2. I can access it in the jsp, no problem. But i can't in the script. What is the problem?

Answer: 
I figured out a way to gat what I wanted but it's rather unclean. Since the anonymous function is a callback function from the Ajax process, I captured the response by defining a parameter for the function. That response is a string with the actual html of the response.

Now, to access the parameter, i have to include its value inside the jsp as a hidden element. Like this:

```
<s:hidden id="hidden_json_entregables" value="%{json_entregables}"/></p>

```

Then, i got it through jquery like this:

```
dojo.event.topic.subscribe("cambioProyecto", function(jsp) {
        var o = $(jsp)
        var string_entregables = o.find("#hidden_json_entregables").text();
}

```

Anyway, i don't think it's a good way to do it so i wouldn't recommend it. But it worked for me. Thank for the support.
Your anonymous function is a callback function. It's called by struts2 when your ajax call completes. I haven't looked into struts2, but it's going to send your callback function parameters. You need to declare those parameters in the anonymous function definition so you can access them. 

So, if json\_entragables is an object returned from struts2 to your callback then you need to write your callback function like this: 

```
dojo.event.topic.subscribe("cambioProyecto", function(json_entregables) {
        //console.log(arguments)
        var hola = json_entregables;
        alert("hola");
}

```

Of course you can rename json\_entragables to anything you like in this case. If you're not sure what struts2 sends you can you can use your favorite debugger to inspect the functions arguments array and see what is there.