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

156
Visualizações
Pass a JavaScript function as parameter with arguments

I have the following scenario:

function myHandlerFunction(data){
   //do anything with data...
}

function ajaxHTTP(url, dataPost, funct){
   $.ajax({
       type: "POST",
       url: url,
       data: dataPost,
       dataType: "html",
       success: function(data){
            funct(data); //Response is coming as plain-text
       },
       error: function(errMsg) { } //To see the error message, use the var of parameter
   });
}

ajaxHTTP("https://example.com", { field: "value" }, myHandlerFunction);

It is working well, but I need to pass parameters in method myHandlerFunction, how I can do that?

Is possible: ajaxHTTP("https://example.com", { field: "value" }, myHandlerFunction(arg1, arg2));

about 4 years ago · Juan Pablo Isaza
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