0

My question evolves java and javascript.

Some point of my program i need to:

1) @Javascript page (.js) i need to get the result of a query

  • Only on this page i can get an set of values and i need to pass to that query in the java file

2) @Java after receive the value i need to pass the result to the same .js

3) the jsp page only call the function/page js

  • I can't change anything on jsp so that's my BIG problem

Resume: I have to pass a value from js (the only source to get this value) into a query in Java file, and then the same js receive the result of that query. I can't change jsp or make another jsp.

I know is difficult but anyone can help me?

John John
  • 33
  • 8
  • Possible duplicate of [How to make an AJAX call without jQuery?](http://stackoverflow.com/questions/8567114/how-to-make-an-ajax-call-without-jquery) – BackSlash Feb 09 '17 at 10:17

1 Answers1

0

You can create ajax call(using jquery, prototype, XMLHttpRequest, whatever best fits existing structure), with request to desired servlet, and from servlet you can parse you query using request.getParameter(String s), after doing what you want with that query, you can send response back using response.getWriter().write(String s) and do what you want to do with response in javascript function

Dmytro Grynets
  • 923
  • 11
  • 29