How to redeclare a Function after loading new content with Ajax?

Asked

Viewed 40 times

0

I need to assign to the new elements loaded through a request ajax this Function bloginfos(). There’s a more elegant and professional way in my code of doing this?

$("#frm_busca_projetos").on("change", function(){
    var termo = $("#termio").val();

    $.ajax({
        url: CAMINHO_JAVASCRIPTI+'/projetos/ajaxgetprojects',
        type: 'POST',
        dataType: 'html',
        data: {termo:termo, categorias:categorias, publicado:publicado, midia:midia},
        success: function(retorno) {
            $("#allinprojects").fadeOut(400, function() {
                $("html, body").animate({scrollTop: 0}, 800);
                $(this).empty().append(retorno);
                $(this).fadeIn(400);
                bloginfos();
            });
        }
    });
}); 
  • What does this function do? Is it called in another context as well? there is nothing intrinsically wrong there, but there may be other ways to achieve the same result.

  • Good morning. Then this Function activates the click that performs an effect on the other open/close Ivs to show content.

  • is nothing that can be solved with on()?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.