Hello,
I'm trying to create cascading DDLs.
My aspx page:
<form id="form1" runat="server">
<table>
<tr>
<td>סוג שולחן</td>
<td><asp:DropDownList ID="ddlTableType" runat="server" /></td>
</tr>
<tr>
<td>קוד שולחן</td>
<td><asp:DropDownList ID="ddlTableCode" runat="server" /></td>
</tr>
<tr>
<td>הנחה קבועה לשולחן</td>
<td><asp:DropDownList ID="ddlDiscounts" runat="server" /></td>
</tr>
</table>
</form>
I'm populating the first DDL from DB and that is working fine.
Now, for the second DDL i'm using this code:
$(document).ready(
function()
{
$("#ddlTableType").change(
function()
{
$('#ddlTableCode').html('');
var TypeID = $("#ddlTableType > option:selected").attr("value");
$.getJSON('LoadTableCodes.ashx?ObjectType=' + TypeID, function(TableCodes) {
alert('aaaaaaaaaaaaaa');
$.each(TableCodes, function() {
alert(this['TableCode']);
$("#ddlTableCode").append($("<option></option>").val(this['TableCode']).html(this['TableCode']));
});
});
}
);
}
);
When i'm browsing to LoadTablesCodes with a typeId im getting the JSON resould. This is working...
My problem is with the js code i think, my $.getJSON function is not working (can't even get the alert inside the function to pop).
Please, what am i doing wrong?
10x