Hi Mike Rosenberger,
Thanks for Contacting Syncfusion support.
We can bind the JSON data returned from any web API services to our Autocomplete control. We have here prepared a sample using AJAX post method that call the web API and returns the JSON data. Define an AutoComplete control and in its change event call AJAX post to the web API, on its success event get the JSON data and bind it to AutoComplete’s suggestion list using the private method _doneRemaining().
Please refer the below code example:
$('#autocomplete').ejAutocomplete({
change: "showCurrentSearch",
fields: { text: "Name", key: "id" }
})
function showCurrentSearch(args) {
if (args.value != "")
$.ajax({
type: "POST",
data: '{searchletter: "' + args.value + '" }',
contentType: "application/json; charset=utf-8",
crossdomain: true,
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert(response); }
})
}
function OnSuccess(response) {
var data = $("#autocomplete").ejAutocomplete("instance");
if (response.length>0)
data.suggestionListItems = JSON.parse(JSON.stringify(response));
data._doneRemaining();
}
} |
Regards,
Narayanasamy P.