0

我有这个问题,运行函数 getBugReports 后无法加载诸如tips 和 prettyPhoto 之类的函数,alrady try .on .live 没有解决方案。

我试过这样,但我无法工作

   $('#bug-reportes .unstyled').on("getBugReports",function(){
      $($this).html(bugs.join(''));

     });

在源代码下方,如果有人可以帮助我,我将不胜感激:

function getBugReports() {
    $.getJSON('php/bugs.modal.php', function (data) {
        $('#bug-reportes .unstyled').empty();
        var bugs = [];
        var tipo;
        var arquivo;
        var arrow;
        var status;
        var lightbox;
        var nomearquivo;
        $.each(data, function (key, bug) {
            if (bug.tipo == 0) {
                tipo = '<span class="label label-important">Erro</span>';
                arrow = '<span class="icon12 typ-icon-arrow-right red">';
            } else if (bug.tipo == 1) {
                tipo = '<span class="label label-warning">Dúvida</span>';
                arrow = '<span class="icon12 typ-icon-arrow-right yellow">';
            } else if (bug.tipo == 2) {
                tipo = '<span class="label label-info">Sugestão</span>';
                arrow = '<span class="icon12 typ-icon-arrow-right blue">';
            }
            if (bug.status == 1) {
                status = '<span style="float: right;" class="label label-success">Resolvido</span>';
            } else {
                status = '<span style="float: right;" class="by label">Pendente</span>';
            }
            if (bug.arquivo != "0") {
                lightbox = 'rel="prettyPhoto"';
                arquivo = '../arquivos/bugs/' + bug.arquivo;
                nomearquivo = bug.arquivo;
            } else {
                arquivo = '#';
                nomearquivo = 'Nenhum arquivo';
                lightbox = '';
            }
            bugs.push('<li>' + arrow + tipo + ' <a href=' + arquivo + ' ' + lightbox + ' class="tip" title=' + bug.descricao + ' >' + nomearquivo + '</a>' + status + '</li></span>');
        });
        $('#bug-reportes .unstyled').html(bugs.join(''));
    });
}

//when modal is show
$('#bug').on('show', function () {
    getBugReports();
});
//when modal is closed
$('#bug').on('hidden', function () {
    getBugReports();

});
4

0 回答 0