-2
I intend to display the number of unread messages. I am using the following code: Where returns the value of unread messages:
<a href="#" class="notification"> <input type="button" id="btn-mensagem" name="btn-mensagem" class="botao" data-toggle="modal" data-target="#modal-mensagem" style="float: right; margin-right:15%;"> <span class="badge" id='msgNumero'></span> </a>
I’m using the following script:
function novasMensagens(numero){
$.ajax({
type: 'GET',
url : './fetchbusca',
success : function(data) {
var numero = data;
var retorno = numero > 0 ? "" : numero;
document.getElementById("msgNumero").innerHTML = novasMensagens(numero);
}
});
}
Have you ever tried to put it that way
document.getElementById("msgNumero").innerHTML = retorno;
?– JrD
@Jrd no longer shows the alert, it is as in the second image
– Bruno
What
console.log(data)
returns?– Marconi
Please [Dit] your post and reduce the problem to a [mcve] to enable a reply within the template of the site. More details on [Tour] and [Help].
– Bacco