Binding Dropdownlist using jquery

Posted by Geetha on Stack Overflow See other posts from Stack Overflow or by Geetha
Published on 2010-04-10T05:57:26Z Indexed on 2010/04/10 6:03 UTC
Read the original article Hit count: 325

Filed under:
|

Hi All,

I am try to bind the dropdowmlist using jquery. But is showing some error.

Code:

                     $.ajax({
                      type: "POST",
                      contentType: "application/json; charset=utf-8",
                      data: "{product: '" + product + "'}",
                      url: "Search.aspx/FetchCategory",
                      dataType: "json",
                      success: function(data) {
                      $.each(data.d, function() {
                              $("#ddlCategory").append($("<option></option>").val(this['ID']).html(this['Category']));
                          });
                      }
                  });

values in the data: [{"Category":"All","ID":"%"},"Category":"Action,"ID":"4"},"Category":"Race,"ID":"5"},"Category":"Sports,"ID":"6"}]

Error:

$("#ddlCategory").append($("").val(this['ID']).html(this['Category'])); Microsoft JScript runtime error: Object doesn't support this property or method

Geetha

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dropdownlist