R
R
robotcigan2015-04-27 16:50:00
JavaScript
robotcigan, 2015-04-27 16:50:00

How to pass ajax request parameter to jstl sql:query tag?

There is a page with a list of orders. When clicking on one of them, the id of this order should be transferred to the jstl tag into the 'element' variable for the subsequent display of a modal window on the same page with a detailed description of this order.

select * from QUERY where ID_QUERY='<%=element %>'

Any help would be appreciated

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
robotcigan, 2015-04-28
@robotcigan

I solved my own issue. It turned out that the easiest way to use jQuery was to load part of my form into the modal window using .load() and pass one 'element' parameter along with it.
When order is clicked
$( "#orderLoad" ).load( "/view/orderLoad.jsp", { "element": element } );
And why does the query variable change on the jsp page and what I need is displayed
select * from QUERY where ID_QUERY='<%=element %>'

A
Andrey Dyrkov, 2015-04-27
@VIKINGVyksa

I think usually when generating a page, a data-attribute is added to each task (for example, it will be data-task-id). We hang an event on each task that will simply take the value from the data attribute of the corresponding order (we use this, do not be shy). Then we simply send this data in the form of JSON to the server, to the file that will process this functionality. Let's say a JSON {id: value} object comes to us. In the POST array, we take it, take the id value, execute the request, get the information, and output the response (echo, print_r or whatever). On the client, we receive our server response (response), create a modal window in which we place the response. I did something like this, maybe someone will offer a better one)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question