Hi
I have the following script which retrieves dropdown values from a web service, it works fine after making the call to the web service as it returns the 1st items if I display the value using "alert". However, it doesn't populate the <as:dropdownlist>
ddlSearchASP at all
Please see below for the script. Am I missing anything populating the dropdown?
Thanks in advance. Your help would be greatly appreciated!
<script>
$(document).ready(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/WebServices/myWebServices.asmx/PopulateSearchDropDownList",
data: "{}",
dataType: "json",
success: function (Result) {
Result = Result.d;
$.each(Result, function (key, value) {
alert(value.FID + ' ' + value.FName); <-- it returns the value correctly
$("#ddlSearchASP").append($("<option></option>").val
(value.FID).html(value.FName)); <-- nothing happened
return false
});
},
error: function (Result) {
alert("Error");
}
});
});
</script>
<body>
<asp:DropDownList ID="ddlSearchASP" runat="server"> </asp:DropDownList>
</body>