I have a Bootstrap 3.3.7 modal (#calendarModal
) being opened when an
tag is clicked:<a>
<a style="display:block" href="#" data-toggle="modal" data-target="#calendarModal">
I want to make a jquery ajax request when the modal has opened.
I've taken a look at https://github.com/twbs/bootstrap/issues/5169 but binding won't work. For example the link suggests:
$('#calendarModal').bind('load', function() { /* do something cool */ });
That doesn't work. If I use console.log
inside the function to test it, it doesn't seem to fire.
How can this be done? I realise I could target the click on the anchor but I'd prefer to know how to do it when the modal is loaded?