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

199
Vistas
Calling java method in Javascript loop function

I am running a javascript function which is under a for loop. The called javascript function calls a java method with the passed parameters. I don't know why java method not execute each time javascript function in loop is called. But it executes after loop has completed. So, called java method doesn't follow the order of passed parameter. The sample code of my program will look like this:

function firstfunction() {
    var x = 5;
    for (var j = 0; j < 5; j++) {
        secondfunction(j, x);
    }
}

function secondfunction(j, x) {
    JavaClass.Javamethod(j, x, callback);
}

Java method do some calculation and return some value as callback. I want my code to call the java method and return the value and then go in javascript loop to take the next parameter and so on.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can not directly call the Java method/function once JavaScript code is executed, to execute that you have to use JavaScript ajax function which is used to execute backend programming language function for eg. Java method based on the url you defined of that method and passed the parameters in the ajax 'data' which is required by the java method and in ajax response you will get the return value of that java method.

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