Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda