Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

159
Visualizações
optimize ajax code and don't repeat myself

This is my code I don't want repeat my ajax how can I optimize it ? and then have shorter code? so i show you just an example here:

function for() {
if (forceexs) {
    if (login == "inte") {
        $.ajax({
            url: "index_content.php?mode=ppanel=forgotten&force_mssante=0",
            success: function (html) {
                $(".panel-body").html(i18n.tr(html));
                $("#rpps").focus();
            },
        });
    } else if (login == "ex") {
        $.ajax({
            url: "index.php?mode=nel=forgorce_mssante=1",
            success: function (html) {
                $(".panel-body").html(i18n.tr(html));
                $("#rpps").focus();
            },
        });
    } else {
        $.ajax({
            url: "index.php?mode=phel=internal_or_external",
            success: function (html) {
                $(".panel-body").html(i18n.tr(html));
                $("#rpps").focus();
            },
        });
    }
} else {
    $.ajax({
        url: "index.php?mode=pel=forgotten",
        success: function (html) {
            $(".panel-body").html(i18n.tr(html));
            $("#rpps").focus();
        },
    });
}
}

This is the shortest one more easy to understand

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

function ajaxRequest(GETQuery) {
  $.ajax({
    url:'index_content?'+GETQuery,
    success: function(html) { 
      $(".panel-body").html(i18n.tr(html));
      $("#rpps").focus();}
    })
  }
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda