Bootstrap popover content cannot changed dynamically

后端 未结 14 2294
旧时难觅i
旧时难觅i 2020-11-29 22:40

I use the code as follows:

$(\".reply\").popover({
  content: \"Loading...\",
  placement: \"bottom\"
});

$(\".reply\").popover(\"toggle\");
14条回答
  •  情书的邮戳
    2020-11-29 23:23

    HTML

    algun nombre
    

    JQUERY

    $('a.Evaluar').on('click', function () {
        var a=$(this);//.attr('data-content', "mañana");
        $.ajax({
            url: "../IndicadorControlador?accion=BuscarPorProceso&cP=24",
            type: 'POST',
            dataType: 'json'
        })
                .done(function (response) {
                    //alert("done. ");
                    var ind = "";
                    $(response).each(function (indice, elemento) {
                        //alert(elemento.strIdentificador);
                        //console.log('El elemento con el índice ' + indice + ' contiene ' + elemento.strIdentificador.toString());
                        ind += ''+elemento.strIdentificador.toString()+'';
                    });
                  $(a).attr('data-content', ind);
                })
                .fail(function () {
                    sweetAlert("ERROR!", " Algo salió mal en el controlador!", "error");
                })
                .complete(function () {
                });
    
        $('[data-toggle="popover"]').popover();
    });
    

提交回复
热议问题