Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!