Taking reference from this article
Make AJAX JSON call to ASP.Net WCF Service using jQuery and Javascript
I have modified its HTML page to populate a DropDownList
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script type = "text/javascript">
$(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '<%=ResolveUrl("~/Services/Service.svc/GetCustomers") %>',
data: '{"prefix": ""}',
processData: false,
dataType: "json",
success: function (response) {
var customers = eval(response.d);
var html = "";
$.each(customers, function () {
$("[id*=ddlCustomers]").append('<option value = "' + this.Id + '">' + this.Name + '</option>');
});
},
error: function (a, b, c) {
alert(a.responseText);
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:DropDownList ID = "ddlCustomers" runat="server">
</asp:DropDownList>
</form>
</body>
</html>