Answer the question
In order to leave comments, you need to log in
The bootstrap popup does not open from the first click, and the necessary data is not loaded by ID, what's wrong?
In general, you need a grid in the popup, when you click, the ID is transferred to the server, and there it makes a renderPartial, jquery code:
$('#warningHistory').click(function(e) {
$.post(
$(this).data('uri'),
{
'id': $(this).data('id')
},
function(result) {
$('.report-index').append(result);
$('#warningHistoryModal').on('shown.bs.modal', function () {
$('#closeButton').focus()
})
}
);
});
$('#warningHistory').click(function(e) {
e.preventDefault();
$('#warningHistoryModal').on('shown.bs.modal', function () {
$.post(
$(this).data('uri'),
{
'id': $(this).data('id')
},
function (result) {
$('.report-index').append(result);
}
)
}
);
});
Answer the question
In order to leave comments, you need to log in
1. the code you provided does not open the modal, but sends an ajax request
2. why renderPartial and not renderAjax?
3. Bind ajax not to the click, but to the "show.bs.modal" or "shown.bs.modal" event (the latter is more reliable), then everything will be ok.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question