jquery - Cascading dropdownlist not working -


i tried change cascading dropdownlist example http://www.codedigest.com/articles/jquery/224_building_cascading_dropdownlist_in_aspnet_using_jquery_and_json.aspx

but message "microsoft jscript runtime error: object expected"

maybe has idea?

<asp:content id="content1" contentplaceholderid="contentplaceholderhead" runat="server"> </script src="~/_scripts/jquery-1.4.2.js" type="text/javascript"> <script language="javascript">     $(document).ready(function () {         $("#<%=ticket_artdropdownlist.clientid %>").change(function() {             $("#<%=ticket_statusselect.clientid %>").html("");             var ticket_art = $("#<%=ticket_artdropdownlist.clientid %> > option:selected").attr("value");             if (ticket_art != 0) {                 $.getjson('ticketdetails.ashx?ticket_art=' + ticket_art, function(cities) { //wozu dient dieses "cities" ?                     $.each(cities, function() {                         $("#<%=ticket_statusselect.clientid %>").append($("</option>").val(this['ticket_art']).html(this['text']));                     });                 });             }         });     }); </script> 

can't tag code "sourceode" because not working corectly..

<asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <div> 

ticket_id: ticket_art: ticket_status:

what stands out @ me script tag...i don't believe jquery being included correctly, this:

</script src="~/_scripts/jquery-1.4.2.js" type="text/javascript"> 

should be:

<script src="~/_scripts/jquery-1.4.2.js" type="text/javascript"></script> 

also check source, make sure ~/ being resolved correct directory in final html. in loop, $("</option>") should be: $("<option/>").

the last suggestion can use .val() directly on <select> current value, this:

var ticket_art = $("#<%=ticket_artdropdownlist.clientid %>").val(); 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -