views:

26

answers:

1

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

A: 

The Problem was with jquery 1.4.2, In my searches i'v read that 1.4 fails silently in all the procces can't finish, i went back to 1.3 and every thing was working, i've got a very simple error at the end wich i corrected and it working.... 10x

Erez