Finding out when both JSON requests have completed
<p>I currently have the following code:</p>

<pre><code>function render(url1, url2, message) {
    utility.messageBoxOpen(message);

    $.getJSON(url1, function (items) {
        // Do something

        utility.messageBoxClose();
    });

    $.getJSON(url2, function (items) {
        // Do something
    });
}
</code></pre>

<p>When the function is executed a modal window appears to inform the user something is loading. Initially I only had one $getJSON request so when the request was done the modal window closed as per the code above.</p>

<p>I am looking to add another $getJSON request but want to close the modal window only when both $getJSON requests have completed.</p>

<p>What is the best way of achieving this?</p>
