Popup does not work after AJAX?

There is a button view < a class="schedule_popup_fos smt-popup-link" href="#smt-popup-order">to Join a >
AJAX loads the same buttons, clicking on which should work out a library of Magnific Popup (dimsemenov.com/plugins/magnific-popup/) and open the appropriate window.

After AJAX click tracking, this script
$(document).ready(function(){
$('body').on('click', '.schedule_popup_fos', function(e) {
e.preventDefault();
$('.smt-popup-link').magnificPopup({
type: 'inline',
autoFocusLast: false
});
});
});

Window only appears after the 2nd click on the button.
June 26th 19 at 14:04
2 answers
June 26th 19 at 14:06
I also had this problem, and I fixed it, just re-hooked up the jquery library
June 26th 19 at 14:08
> Window only appears after the 2nd click on the button.

because you inicializirati the first click, and need to College Ajax

$('body').on('click', '.schedule_popup_fos', function(e) {
e.preventDefault();
$('.smt-popup-link').magnificPopup({
type: 'inline',
autoFocusLast: false
});
});
Hello, I don't give a shit how you need to initialize correctly, that would open at the first click?

My code:
$('body').on('click', '.ajax-item', function(e) {
e.preventDefault();
$('.room-popup').magnificPopup({
 mainClass: 'mfp-fade',
 removalDelay: 300,
 type: 'inline',
});
 });
- nikita.Stracke commented on June 26th 19 at 14:11

Find more questions by tags AJAXjQueryJavaScript