Home Forums Event Espresso Premium Get event ID on registration Attendee Information entry page for AJAX

Get event ID on registration Attendee Information entry page for AJAX

Posted: January 12, 2020 at 5:31 pm


January 12, 2020 at 5:31 pm

We are testing Event Espresso on a test server (local computer /etc/hosts line item set: before implementing on production server.

Page 1.
On setting the first event QTY to 1 (4-5 June: Main Conference Early Registration) and click on “Register Now”

Page 2.
Brings up “2 Attendee Information” entry page.

We would like to identify the Event ID on Page 2 using jQuery to get information on an AJAX call. It would be nice if there were a hidden field with the event ID, but since there isn’t how can we get the event ID for use in an AJAX call?

Browser developer tools and “view page source” shows the event ID many times on the first page. Such as in the body tag:
body class=”espresso_events-template-default single single-espresso_events postid-32852 …

It shows the registration page id on the Attendee Information entry page, but does not show the event ID at all on the Attendee Information entry page.
Such as in the body tag:
body class=”page-template-default page page-id-32835 fusion-image-hovers fusion-body ltr no-tablet-sticky-header no-mobile-sticky-header no-totop no-mobile-totop fusion-disable-outline fusion-sub-menu-fade layout-wide-mode fusion-top-header menu-text-align-left mobile-menu-design-classic fusion-show-pagination-text fusion-header-layout-v4 avada-responsive avada-footer-fx-none fusion-search-form-classic fusion-avatar-square”

The WordPress registration page ID is 32835
| 32835 | 8 | 2019-12-16 14:55:08 | 2019-12-16 22:55:08 | [ESPRESSO_CHECKOUT] | Registration Checkout | | publish | closed | closed | | registration-checkout | | | 2019-12-16 14:55:08 | 2019-12-16 22:55:08 | | 0 | | 0 | page | | 0 |

The WordPress event ID is 32852
| 32852 | 8 | 2019-12-16 15:53:57 | 2019-12-16 23:53:57 | This is going to be a great conference. | LocWorld42 Berlin | | publish | closed | closed | | locworld42-berlin | | | 2020-01-09 09:33:26 | 2020-01-09 17:33:26 | | 0 | | 0 | espresso_events | | 0 |


  • Support Staff

January 13, 2020 at 6:06 am

Hi there,

Whilst it’s possible to add the event ID(s) to the body class mentioned above, I don’t really recommend doing so and you have a better option of pulling the events directly from the users session.

Here’s an example of how you can use the ssn to add the event ids to the body class:

But again, if you are going to do that for an ajax request, you could just do almost exactly the same on said request and pull the event id’s directly rather than loading them into the page, to find them using jQuery, to pass them to the ajax request to use them.

The support post ‘Get event ID on registration Attendee Information entry page for AJAX’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Tony 6 months, 3 weeks ago ago

Topic Tags


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!