简体   繁体   中英

I want to load content into a bootstrap 4 modal using intercooler.js

I'm trying to load content into a modal using intercooler, example here:

http://jsfiddle.net/qvpy3coL/3/

I'm having no joy and wonder if this is possible, or whether the bootstrap js will conflict?

Html is:

<div id="confirm-me" class="btn btn-primary" data-toggle="modal" 
    data-target="#msgmodal" ic-get-from="/click" ic-target="dynamiccontent"
    ic-trigger="click">
    Click Me to show dynamic modal</div>

<div class="modal fade" id="msgmodal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                 <h4 class="modal-title">
                 Below will be dynamic content</h4>
            </div>

            <div id="dynamiccontent">
            </div>
        </div>
    </div>
</div>

js is:

// mockjax stuff ...
$.mockjax({
    url: "/click",
    responseTime: 500,
    response: function (settings) {
        this.responseText = "Dynamic stuff here!";
    }
});

I've never used intercooler but after a quick read it turns out there should be no problem.

The only requirement with dynamic content you want in the modal is that it should be valid HTML code.

I played with the example you put in some content:

$('#dynamiccontent').html('No, it wont have any problems as long as your placing HTML')

https://jsfiddle.net/5pe6yz0w/3/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM