I have an ajax fonction that almost work, the part that doesn't is when it gets to innerHTML function. I'm trying to change the text inside a td when success part is reahced.
In my .cshtml file of an MVC project, I have this simple HTML an JS :
// This td is not part of a loop, it is just inside a single table and tr
<td id="SommePour" style="min-width: 480px;" colspan="2">
Somme pour @(Model.PbSelected?.Insert(4,"-").Insert(3,"-") ?? "000-0-00000")
</td>
<script>
function NouveauTotal(noCompt9) {
$.ajax({
url: '@Url.Action("ChangeSousTotaux", "Explorer")',
type: 'post',
data: {
postBudg9: noCompt9
},
success: function (result) {
$("#SommePour").innerHTML = "<span>Somme pour " + '' + noCompt9 + ''.substring(0, 3) + "-" + '' + noCompt9 + ''.substring(3, 4) + "-" + '' + noCompt9 + ''.substring(4, 9) + "</span>";
}
});
}
</script>
I even tried :
$("#SommePour").innerHTML = 'yo';
I searched :
Changing td element text using Javascript
.substring error: "is not a function"
But nothing came to my mind...