How to send content from an html table to a form from another page with javascript and jsp

0

Estimated how you could capture the data of a table made in jsp and show it with javascript in a form of another page? I have tried but within the same page but when I want to show it on another page it is not displayed.

The example code I am using is as follows to explain the subject in a simple way.

<table id="resultado">
<thead>
<tr>
<th>id</th>
</tr>
</thead>
<tbody>
<tr>
<td>HOLA</td>
</tr>
</tbody>
</table>




<script>
  $(document).ready(function () {
      $("#resultado tbody tr").on ("click",function (event) {
          //var value = $(this).val();
          var id= $(this).find("td:first-child").html();
          $("#txt_mostrar_num_eliminar").val(id);
      });
  });

</script>

Here the form on the other page

<form>
<b>ID:</b><input type="text" id="txt_mostrar_num_eliminar">
</form>

This works for me if the form that receives the value is on the same page but when it's on another page, it does not work for me.

referential image of the original project that I am doing as seen when I see the data in a modal located on the same page

here reference image of the original project that I am doing when I try to see the same data but in another page please if you could help me.  thanks

    
asked by Simón Pereira Vigouroux 28.11.2018 в 14:44
source

0 answers