How can I remove the same value queryString when searching for ID in jQuery, ID is being pass in textarea and calls an API when searching. When searching for similar IDs it shows two similar items, so if I can remove the same queryString values it would prevent it from fetching similar items.
QueryString looks like this Product?id=1&id=1 then renders the item twice.
Getting the values from textarea
var getVal = $('textarea.input_' + inputSearch.name).val();
if (getVal != null && (getVal != "")) {
let inputValues = getVal
.split("\n") // allows multiple search using new line
.filter(function (str) { return str !== "" })
.join("&" + inputSearch.name + "=");
// then add it to the overall query string for all searches
query = query + inputSearch.name + "=" + inputValues + "&";
}
id=1&id=1