Can you help me understand where the error is?
function atualizaLista(id_leilao) {
if (id_leilao) {
$.ajax({
url: 'get.php',
dataType: 'json',
type: 'POST',
data: 'id_leilao=' + id_leilao,
global: false,
success: function (data) {
for (i = 0; i < data.histories.length; i++) {
biddingusername = data.histories[i].history.username;
biddingprice = data.histories[i].history.bprice;
biddingtime = data.histories[i].history.time;
document.getElementById('bid_user_name_' + i).innerHTML = biddingusername;
document.getElementById('bid_price_' + i).innerHTML = 'R$' + biddingprice;
document.getElementById('bid_time_' + i).innerHTML = biddingtime;
}
}, error: function (XMLHttpRequest, textStatus, errorThrown) {
}
}); // fim ajax
} // fim if
}
Uncaught TypeError: Can not set property 'innerHTML' of null
Tell me what's in this line:
document.getElementById('bid_user_name_' + i).innerHTML = biddingusername;
HTML:
<tr class="producthisrow">
<td align="center" id="bid_user_name_<?= $q; ?>"></td>
<td align="center" id="bid_price_<?= $q; ?>"></td>
<td align="center" id="bid_time_<?= $q; ?>"></td>
</tr>