On such button if you use the type="button" class="fazQuery"
can use query via AJAX in javascript example:
$(".fazQuery").on('click', function() {
$("#modalId").modal('show');
$("#modalBody").html("A carregar...");
$.ajax({
url: "urlProcura.php",
data: {query: "Texto a procurar??" },
success: function(resultado) {
$("#modalBody").html(resultado);
},
error: function(erro, resultado) {
alert("Ocorreu um erro tente novamente.");
}
});
});
In case you are using a bootstrap modal the function to open the modal is modal('show')
Example of modal to be used:
<!-- Modal -->
<div class="modal fade" id="modalId" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body" id="modalBody">
A carregar...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
Can you put the
submit
at the eventclick
of yourbutton
:<button type="button" onclick="javascript: <Apontar o form aqui>.submit();">Botão</button>
. If it fits, put your code I’ll give you a complete answer.– LipESprY
Post the HTML and Javascript Code you are using to hood the data and display the modal
– KaduAmaral
https://pastebin.com/BNhQeucU
– Rodrigo Caio
I found a solution, but it is creating the modal within the data display while, ie, a modal for each record.
– Rodrigo Caio
I don’t understand the difficulty. You have a View type="button" button to open the modal that works. Click and open the modal. In the modal you have the information, a Close button (that works) and another Save changes. Does not use button type="Submit" in this Save changes? If there was a form in the code there would be solution to use type="button" in Save changes.
– user60252