I am using Jquery cascading dropdownlist & while using response.d i am not getting the other DDL fill on the basis of first selection.
CODE :
<script type="text/javascript">
var pageUrl = "<%=ResolveUrl("~/DataEntry/FormF.aspx")%>"
function PopulateMTPCondName() {
$("#<%=ddlDrNameMTPCond.ClientID%>").attr("disabled", "disabled");
if ($("#<%=ddlDesignation.ClientID%>").val() == "0") {
$("#<%=ddlDrNameMTPCond.ClientID %>").empty().append("<option selected=selected value=0>Please select</option>");
}
else {
$('#<%=ddlDrNameMTPCond.ClientID %>').empty().append("<option selected=selected value=0>Loading...</option>");
$.ajax({
type: "POST",
url: pageUrl + "/PopulateMTPCondName",
data: '{Code: "' + $("#<%=ddlDesignation.ClientID%>").val() + '"}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnMTPCondPopulated,
failure: function (response) {
alert(response.d);
}
});
}
}
function OnMTPCondPopulated(response) {
PopulateMTPControl(response.d, $("#<%=ddlDrNameMTPCond.ClientID %>"));
}
function PopulateMTPControl(list, control) {
if (list.length > 0) {
control.removeAttr("disabled");
control.empty().append("<option selected=selected value=0>Please select</option>");
$.each(list, function () {
control.append($("<option></option>").val(this['Value']).html(this['Text']));
});
}
else {
control.empty().append("<option selected=selected value=0>Not available<option>");
}
}
</script>
response.d (Which has been bold) there i am getting undefined.
Please help !!!!!
Thank U !!!!
Lipica