I am trying to link dropdowmlist using jquery. But some error is displayed.
the 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']));
});
}
});
data values: [{"Category": "All", "ID": "%"}, "Category": "Action" ID ":" 4 "}," Category ":" Race "ID": "5 "}," Category ":" Sports "ID": "6"}]
Error:
.$ ("# ddlCategory") add (.. $ ("") Val (this is ['ID']) HTML (this is ['Category'])); Microsoft JScript runtime error: object does not support this property or method
Gita
source
share