jquery how to call a function on document ready
<p>Hi could someone help me out with this jQuery? I have:</p>

<pre><code>$(document).ready(function () {

    window.refresh = function () { setorganisationddl; }

    var setorganisationddl = function () {
        if ($("#Invoice_AreaId option:selected").val() == "") {
            $("#Invoice_OrganisationId &gt; option").remove();
            $("#Invoice_OrganisationId").append($("&lt;option value=''&gt;-- Select --&lt;/option&gt;"));
            $("#Invoice_OrganisationId").attr("disabled", "disabled");
        }
        else {
            $.get('/Invoice/GetOrganisationSelectList/' + $("#Invoice_AreaId option:selected").val(), function (response) {
                $("#Invoice_OrganisationId").removeAttr("disabled");

                var organisations = $.parseJSON(response);

                var ddlOrganisations = $("#Invoice_OrganisationId");

                $("#Invoice_OrganisationId &gt; option").remove();

                for (i = 0; i &lt; organisations.length; i++) {

                    if (organisations[i].Value == $("#Invoice_OrganisationId option:selected").val()) {
                        ddlOrganisations.append($("&lt;option selected='selected' /&gt;").val(organisations[i].Value).text(organisations[i].Text));
                    }
                    else {
                        ddlOrganisations.append($("&lt;option /&gt;").val(organisations[i].Value).text(organisations[i].Text));
                    }
                }
            });
        }
    }

    $("#Invoice_AreaId").change(setorganisationddl);
});
</code></pre>

<p>So I have setorganisationddl being called when ddl with id Invoice_AreaId is changed. Great. However I also want it called when the page loaded.</p>

<p>As you can see I tried:</p>

<pre><code>window.refresh = function () { setorganisationddl; }
</code></pre>

<p>which doesn't work.</p>
