There is a code that simply compares the value in a variable with the value in json, when it finds a match, displays the necessary information. But I don’t manage to implement a mechanism that would display a message that there are no search results.
Instead, the function displays that there are no results several thousand times. That is, every time a reconciliation occurs and there are no matches, json displays a message.
How can I solve the problem?
Here is my code:
function Zvalue(value_test) { $.each(allNam, function(key, val) { if (value_test == value['actNam']) { setTimeout(function() { gomasege(value['varNam']) }, 600); } else if (value_test !== value['actNam']) { console.log("нет совпадений") } }) }