Eventbrite API integration: Displaying the event’s image

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:

if(event.logo) {
var image = "<img src=’" + res.events[i].logo.url + "’>";
} else {
image = ”;

Below is the full script I used with the help from Camden’s post: