Bootstrap 4 Modal Remote Data Loading
In the latest release of Twitter Bootstrap (v4 alpha), the ability to load remote content into a modal has been removed. This functionality existed in Bootstrap 3, but is no longer supported.
Problem
When attempting to use the data-remote attribute to load remote content into a modal in Bootstrap 4, the model body remains empty and no request is sent to the specified URL.
Solution
To resolve this issue, you can use JavaScript to manually load the remote content into the modal body. Here's an example:
$('body').on('click', '[data-toggle="modal"]', function(){ $($(this).data("target") ' .modal-body').load($(this).data("remote")); });
This code attaches an event listener to all elements with the data-toggle="modal" attribute. When one of these elements is clicked, it retrieves the data-remote value from the element and uses jQuery's .load() method to load the remote content into the modal body.
Note: The deprecated remote option has been removed in Bootstrap 4 and is recommended to be implemented using client-side templating, data binding frameworks, or by manually calling jQuery.load() as demonstrated above.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3