I have a BS modal which when the dialog loads I query another URI and populate the contents.
When I open and close the modal, and re-open the "shown" event is not triggered and therefore the contents are not re-populated.
$('#ajaxModalPopup').on('shown.bs.modal', function (e) {
// TODO: Load new contents - but only happens on first shown
});
The ID of the modal has to remain static, but I've tried, resetting the modal DIV container to NULL, then re-inserting the modal itself, hoping it would trigger the "shown" event again, but no dice.
Any thoughts?
EDIT | The modal will shown each time the "click" handler is invoked but the modal's own "shown" event won't fire more than once...
$('.open-as-modal').click(function(ev){
$.ajax({
url: this.href,
success: function(result){
$("#ajaxModalPopup").modal('dispose');
$("#modalContainer").html(result);
}
}).done(function(){
$('#ajaxModalPopup').modal('show');
});
return false;
});
This isn't firing more than once:
$('#ajaxModalPopup').on('shown.bs.modal', function (e) {
// TODO: Query another URI and populate contents - only fired once???
});