title: How to call a method javaservlet in function javascript?
body: <pre><code>function ShowMessage() {
      var url = '/primes/PrimesServlet';
      var result = CQ.HTTP.eval(url);
      var i = Number(document.getElementById("input").value);
      var str = document.getElementById("test");
      // if(result.checkPrimes(i)) // Want to call here
      str.innerHTML = i + " là số nguyên tố";
      // else str.innerHTML = i + " là hợp số";
      document.getElementById("output").style.display="block";
  }
  
  public class PrimesServlet extends HttpServlet {
      public boolean checkPrimes(long n) {
          boolean _return;
          MillerRabin obj = new MillerRabin();
          _return = obj.checkPrimes(n);
          return _return;
      }
   }
  </code></pre>
  
  <p>I want to call the method <code>checkPrimes(long n)</code> from my function <code>ShowMessage()</code>, but I can't. </p>