$('#dropdown li').forEach(item => {
item.onclick = () => $('#input').value = item.innerText;
});
function fetchData(){
var s = $("#input").val();
if (s == '') {
$('#dropdown').css('display', 'none');
}
$.post("files/auto_complet.php",
{
s:s
},
function(data, status){
if (data != "not found") {
$('#dropdown').css('display', 'block');
$('#dropdown').html(data);
$('#dropdown li').forEach(item => {
item.onclick = () => $('#input').value = item.innerText;
});
}
}).done(() => {
$('#dropdown li').forEach(item => {
item.onclick = () => $('#input').value = item.innerText;
});
});
}
function fetchData(){
var s = $("#input").val();
if (s == '') {
$('#dropdown').css('display', 'none');
}
$.post("files/auto_complet.php",
{
s:s
},
function(data, status){
if (data != "not found") {
$('#dropdown').css('display', 'block');
$('#dropdown').html(data);
$('#dropdown li').forEach(item => {
item.onclick = () => $('#input').value = item.innerText;
});
}
});
}
$('#dropdown .item') /* Artem */
async function get_post(id) { // id или url в вашем случае - ajaxcomm.php, ajaxtabs.php и т.д.
return await fetch('https://jsonplaceholder.typicode.com/posts/' + id)
.then((response) => response.json())
.then((json) => json);
}
https://blog.logrocket.com/multer-nodejs-express-u...
Должно помочь