1
I have a link that calls a modal bootstrap and I need that when it is clicked, the modal window is opened and a data is loaded in it that was sent as parameter by the link.
The modal link and call is as follows:
<a class="navbar-brand" href="#" data-toggle="modal" data-target="#basicModal"><i class="fa fa-times"></i></a>
And that’s the modal window code:
<div class="modal fade" id="basicModal" tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Modal</h4>
</div>
<div class="modal-body">
<input type="text" id="demo" value="">
<h3> Conteúdo</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
<button type="button" class="btn btn-primary">Salvar</button>
</div>
</div>
</div>
</div>
Does anyone know how I can do this?
Do you want to load the contents of an "external" url dynamically into a modal? Where is this parameter at the current url?
– Rafael Withoeft
Take a look at this link, it talks about using the . modal-content: http://stackoverflow.com/questions/18378720/bootstrap-3-with-remote-modal?answertab=votes#tab-top
– Rafael Withoeft
Not specifically. Actually, as I’m new to WEB programming, I don’t even know which way to go. For example, if it were on different pages, you could for example send something via url, and on another page recover the value that was sent using Php’s GET method. As the modal window is on the same page of the link that calls it, I don’t know what to do.
– João Paulo
If you just want to display information that is already on the page (url in your case), just add the content inside the
<div class="modal-body"> Seu Conteúdo </div>
. Just remember to use the following means to retrieve the information:<?php
 $my_string = filter_input(INPUT_GET, ‘my_string’, FILTER_SANITIZE_STRING);
?>
Source: (http://www.phparch.com/2010/07/never-use-_get-Again/) I hope this is it and I didn’t get it wrong...– Rafael Withoeft
Unfortunately it didn’t work out.
– João Paulo
this modal div, is on the same page of the link that opens it ?
– Tafarel_Brayan
Yes, the modal is on the same page. I was able to solve with the example of this link : http://jsfiddle.net/k7FC2/ .
– João Paulo