Revision #240 has been created by rackycz on Oct 8, 2020, 2:07:47 PM with the memo:
Modal and ajax
« previous (#239) next (#241) »
Changes
Title
unchanged
Yii v2 snippet guide
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,beginner,yii2
Content
changed
[...]
]);
echo "<div id='modalContent'></div>";
yii\bootstrap\Modal::end();
$this->registerJs(
"// If you use $(document).on, it will handle also events on elements rendered by AJAX.
// $(document).on('click','a.openInModal',function(e){
// And if you use $('a.openInModal'), it will work only on standard elements
$('a.openInModal').click(function(e){
// Prevents the browsers default behaviour (such as opening a link)
// ... but does not stop the event from bubbling up the DOM
e.preventDefault();[...]