I'm doing a query on my DB in a janela modal
, now after the query is done, I need to click a button to send the selected parameters to the calling page and to play those parameters in some inputs
, I had previously done this using a url
returning the desired values by closing the modal
, but had a problem, this caused a new page load causing previously populated data from other fields to be lost.
I did this by clicking the submit button:
<button type="button" class="btn btn-primary btn-mini" data-toggle="modal" onclick="EnviaDados()"> enviar </button>
<input id="NomeCooperante" type="hidden" value="<?php echo $Retorno->NomeCooperante; ?>" />
And on the return page like this:
function EnviaDados() { $('#ModalCooperante').modal('hide'); // var valor = $('input[type="text"][name="NomeCooperante"]').val(); var NomeCoop = $(this).attr("NomeCooperante"); alert("COOPERANTE: " + NomeCoop); }
I made some tests, the result of the alert is:
COOPERANTE: [Object HTMCollection]
What I have is this, the search:
AndthefieldsIneedtofillinonreturn.