Posted: January 12, 2020 at 5:31 pm
We are testing Event Espresso on a test server (local computer /etc/hosts line item set: 184.108.40.206 locworld.com http://www.locworld.com) before implementing on production server.
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:
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.
The WordPress event ID is 32852
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.