The project aim was to populate events from Eventbrite on the home page of a WordPress website. The Eventbrite API returns responses in JSON allowing events to be pulled into an web application.
I found this post by Raymond Camden extremely useful, Using JavaScript to integrate with the EventBrite API, and I highly recommend a read if you’re looking at the Eventbrite API.
It was my first time working with JSON and I found it very satisfy. I want to quickly explains how to display the event’s image in your Eventbrite API integration using JavaScript. To display the image I used res.events[i].logo.url. To prevent this returning ‘undefined’, if the event does not have an image, use this conditional statement:
[javascript]
if(event.logo) {
var image = "<img src=’" + res.events[i].logo.url + "’>";
} else {
image = ”;
}
[/javascript]
Below is the full script I used with the help from Camden’s post:
https://gist.github.com/domingobishop/ffb6b1cb8a79296fbb2d