0
How do I stop when I click the trigger editar
, a modal open with the data of an object I previously selected in the table?
Follows my code:
<div class="container">
<div class="row" style="background-color: white; padding: 10px;">
<div class="col-md-3">
<a href="#cadastro" class="edit" data-toggle="modal" data-target="#cadastro">
<span style="width: 20px; height: 50px;" class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</a>
<a href="#editar" data-toggle="modal" class="edit" data-target="#editar">
<span class="glyphicon glyphicon-pencil" style="width: 20px; height: 50px;" aria-hidden="true"></span>
</a>
<a href="#">
<span class="glyphicon glyphicon-trash" style="width: 20px; height: 50px;" aria-hidden="true"></span>
</a>
</div>
<div class="col-md-9">
<div class="input-group">
<input type="text" id="search" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search" aria-hidden="true"></span></button>
</span>
</div>
</div>
</div>
</div>
<div class="container" style="background-color: white;">
<div class="table-responsive">
<table class="table table-striped table-bordered" id="table">
<tr onclick="toggle(this)">
<th>Nome</th>
<th>Email</th>
<th>Papel</th>
<th>Status</th>
</tr>
<tbody>
<c:forEach items="${sessionScope.listaDeUsuarios}" var="usuario">
<tr id="row" onclick="changeColor();">
<td>${usuario.id}</td>
<td>${usuario.username}</td>
<td>${usuario.email}</td>
<td>${usuario.papel}</td>
<td>${usuario.status}</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
Ola Anderson, could you add more information to the question and be more specific regarding your doubt? I’m not getting it.
– gato
I have a table with data coming from the BD, and next to this table I have an html tag <a>, which is a trigger for the user editing modal, which when clicking this modal should open with the fields filled, corresponding to the line I selected, all without making those Servlet requisitions. From what I research, you can do this with Ajax. But I don’t know anything. I could understand?
– Anderson Souza
Post the code to the question and show where to make the modifications. To edit the question just click on the 'edit' button. Read here to learn how to ask and how to create an example.
– gato
The code snippet is on the link.
– Anderson Souza
I edited your question and put the code snippet in it.
– gato
With more information in the question it is better for the community to help you.
– gato