Encountering a challenge where an Ajax call presents the same string multiple times when attempting to autofill a field. This occurs because the URL used in the Ajax call contains the string numerous times within an XML structure.
For instance, upon executing:
/tools/_api/web/lists/getbytitle('Besucheranmeldung')/Items?&$filter=substringof('Aalen', FirmaNeu)&$select=FirmaNeu
The resulting XML appears as follows:
<?xml version="1.0" encoding="utf-8"?><feed xml:base="https://mylink/tools/_api/" xmlns="http://www.w3.org/2005/Atom" ...
https://i.sstatic.net/cXBad.png
A code snippet is utilized to generate the dropdown menu:
var requestHeaders = {
"Accept": "application/json;odata=verbose",
"X-RequestDigest": NWF$("#__REQUESTDIGEST").val()
};
function startAutoComplete(varTextBoxId, listname) {
console.log("startAutoComplete called!");
// Remaining code...
Is there a way to address this issue and prevent duplicate strings from appearing within the dropdown menu?
Upon logging console.log(data.d.results);
, the output is as shown: