Доброй ночи.Скажите пожалуйста,почему я получаю undefined?
$(document).on('click','.tender', (e) => {
console.log(e.target.dataset.id)
})
async function loadTenders(url) {
this.url = url
this.options = {
method: 'POST'
}
const response = await fetch(this.url,this.options)
const data = await response.json()
for(i=0; i<data.id.length; i++) {
$('.tenders').append('<div class="tender" data-id="'+data.id[i]+'"><div class="category">'+data.category[i]+'</div><div class="description"><img class="tender-img" src="'+data.images[i]+'"><div class="text">'+data.description[i]+'</div></div><div class="company"><button class="name">'+data.company[i]+'</button></div></div>')
}
}
loadTenders('/tenders')