안녕하세요,이 jQuery를 도와 줄 수 있습니까? 내가 가진 : 아이디 Invoice_AreaId와 DDL이 변경 될 때 jquery 문서를 준비 할 때 함수를 호출하는 방법
$(document).ready(function() {
window.refresh = function() { setorganisationddl; }
var setorganisationddl = function() {
if ($("#Invoice_AreaId option:selected").val() == "") {
$("#Invoice_OrganisationId > option").remove();
$("#Invoice_OrganisationId").append($("<option value=''>-- Select --</option>"));
$("#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 > option").remove();
for (i = 0; i < organisations.length; i++) {
if (organisations[i].Value == $("#Invoice_OrganisationId option:selected").val()) {
ddlOrganisations.append($("<option selected='selected' />").val(organisations[i].Value).text(organisations[i].Text));
}
else {
ddlOrganisations.append($("<option />").val(organisations[i].Value).text(organisations[i].Text));
}
}
});
}
}
$("#Invoice_AreaId").change(setorganisationddl);
});
이 그래서 setorganisationddl 호출되고있다. 큰. 그러나 나는 또한 페이지가로드 될 때 호출하고 싶다. 당신이 볼 수 있듯이
내가 시도 : 작동하지 않는
window.refresh = function() { setorganisationddl; }
.