WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] ajax loaded list of events with booking button (10 posts)

  1. thor86
    Member
    Posted 1 year ago #

    Hi,

    I am loading a list of events with ajax and each event has the bookings enabled, but the Booking button is not working because the list of events is loaded with ajax, can you give me please a hint on how to fix this?

    Many thanks in advance!

    http://wordpress.org/extend/plugins/events-manager/

  2. thor86
    Member
    Posted 1 year ago #

    How can I enable the js that performs the booking for the ajax loaded content?

  3. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    hi, chances are you have JS on your site breaking the ajax from loading, if you have a link to a booking form we may be able to tell.

  4. thor86
    Member
    Posted 1 year ago #

    Hi Marcus,

    I have this locally on my machine for now. I am using the #_BOOKINGBUTTON placeholder. From what I've noticed the js is not working for the ajax loaded content. If I click an element which should execute a function then nothing happens, unless I call that js function again after that ajax load is complete. But I don't know what function I should call after the ajax load is complete for the booking button to work.
    Thank you!

  5. thor86
    Member
    Posted 1 year ago #

    Any idea how I can re-enable the click events on the ajax loaded content?

  6. agelonwl
    Member
    Posted 1 year ago #

    try to check the browser console if there's any javascript error that can help us figure out the issue; also, check whether your theme loads a jquery version that is compatible with wordpress default jquery library.

  7. thor86
    Member
    Posted 1 year ago #

    Hi aglonwl,

    There is no js error in the console. This issue happens only if I load that list with ajax, if I simply output in the page that list, it works fine to book the events, but I need to load that list with ajax.
    I need to reenable the click for the ajax loaded content. How can I call again the function that fires when clicking on the booking button in the ajax callback function?

    Many thanks for all your help!

  8. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    chances are because the booking button isn't present until after the document is loaded, our scripts don't re-assign the events to the booking button.

    You probably need to copy this and have it execute after your ajax is done:

    //Manual Booking
    	$('a.em-booking-button').click(function(){
    		var button = $(this);
    ....

    See includes/js/events-manager.js around line 383 to 432

  9. thor86
    Member
    Posted 1 year ago #

    Thank you so much Marcus, this fixed it! God bless you!

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    glad it worked ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.