Push return value of jQuery callback function from another function
<p>I have the following problem. Let's say there's a function that opens some kind of dialogue:</p>

<pre><code>function dialogue(param1, param2, callback)
{
    var has_callback = (arguments.length == 3) ? true : false;

    $.get('some_url.php', function(response) {

        if (has_callback) {
            callback(response);
        }

    }, 'json');
}
</code></pre>

<p>Now I can call the dialogue like this:</p>

<pre><code>dialogue('Headline', 'Text', function(response)
{
    console.log(response);
});
</code></pre>

<p>and the response of some_url.php via the $.get method will be logged via the callback.</p>

<p>My problem is now, that the dialog can call a function like this:</p>

<pre><code>function update_dialogue(data)
{
    if (data.callback)
    {
        // is there a way to "push" the callback data
        // to the original dialogue callback function?
    }
}
</code></pre>

<p>and I would like to be able to "push" that callback back to the original dialogue() function. I hope it's clear what I am trying to do and that someone can help me if something like this is possible at all or if I need some kind of listener...?</p>

<p>Thanks!!</p>
