I am using ajax request to retrieve some data from the database, and on success, I update an html table with the data retreived.
the problem is that when I select an element using document.getElementByClassName(className)[0].innerHTML = newValue
I see in the console that the newValue
appears in the table I selected, but in the UI, nothing changed.
my code:
for(var i = 0; i < document.getElementsByClassName('tablesorter').length; i++){
var table = document.getElementsByClassName('tablesorter')[i];
exp_id = table.getAttribute("data-exp_id");
var that = this;
$.ajax({
url : 'get_something.php',
dataType : 'json',
data : {
expression : exp_id
},
success : function(data) {
something= "";
for (var i = 0; i < data.length; i++) {
value = data[i];
something+= '<tr><td>' + value.a + '</td><td>' + value.b + '</td><td>' + value.c + '</td><td>' + value.d+ '</td></tr>';
}
table.getElementsByTagName("tbody")[0].innerHTML = something;
console.log(ailleurs);
}
});
}