How to set global variables in jQuery/JavaScript?
<p>I have an ajax function:</p>

<pre><code>    $.ajax({
        url: 'http://localhost/process.php',
        type: 'post',
        data: '',
        success: function(output) {

var animal = output

        }
    });
</code></pre>

<p>I would like the <code>var animal</code> to be set globally so I can call it anywhere on the page even outside the ajax function's success callback. How to do this?</p>
