1
ola personal I started programming in js and jquery currently I am very beginner and I am with a small problem I am trying to show the content of an outside page in a modal but it shows only link of the search and not the content
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
</button>
<h4 class="modal-title">Paginas</h4>
</div>
<div class="modal-body" id="conteudoModal"></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>
$("a").click(function (e) {
var id = $(this).attr('id');
$('#myModal').modal('show');
$("#conteudoModal").html(this.href);
});
i have another search on this page that works, when I try to use the same code it gives several errors so I tried to do different this is the search
$('#chama').submit(function(e){
e.preventDefault();
$.ajax({
url:'teste_b.php',
method: 'POST',
data: { nome_cliente: $('#nome_cliente').val()}, // sua data chegará como $_POST['busca_data'] no PHP.
success: function(data){
$('#resultado_busca').html(data); // data é o valor printado do lado php
$('#exampleModalLong').modal('show') ; // abre o modal via jquery
}
});
return false; // nao ira para lugar algum
});
I’m still a beginner and I don’t know exactly why it’s not working
I recommend you research what the function
html
jQuery do. You puthtml(this.href)
, which is basically "show me this URL as HTML".– Woss
could give me an explanation please and with I fix I gave a read but I did not understand very well
– Daniel Ricardo