I can’t make the Modal work in the remote mode with the new Twitter Bootstrap release : Bootstrap 4 alpha. It works perfectly fine with Bootstrap 3. With bootstrap 4 I am getting the popup window, but the model body is not getting loaded. There is no remote call being made to myRemoteURL.do
to load the model body.
Code:
<button type="button" data-toggle="modal" data-remote="myRemoteURL.do" data-target="#myModel">Open Model</button>
<!-- Model -->
<div class="modal fade" id="myModel" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<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>
<h3 class="modal-title" id="myModalLabel">Model Title</h3>
</div>
<div class="modal-body">
<p>
<img alt="loading" src="resources/img/ajax-loader.gif">
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</div>
6
Answers
Found the problem: They have removed the remote option in bootstrap 4
I used JQuery to implement this removed feature.
According to official documentation, we can do the follow(https://getbootstrap.com/docs/4.1/components/modal):
So, I believe this is the best approach (works for BS 5 too):
e.relatedTarget is the anchor() that triggers the modal.
Adapt to your needs
As some of the other answers and Bootstrap docs indicate, Bootstrap 4 requires handling the
show.bs.modal
event to load content into the modal. This can be used to either load content from an HTML string, or from a remote url. Here’s a working example…Bootstrap 4 Remote URL Demo
Another option is to open the modal once data is returned from an Ajax call…
Bootstrap 4 Load Modal from Ajax Demo
If you use the Jquery slim version (as in all the Bootstrap 4 docs and examples) the load function will fail
You need to use the full version of Jquery
In Asp.NET MVC, this works for me
html
jquery
Action
This process is loading the current dynamic. data remote = “remoteContent.html”