Question

I'm querying EventBrite with JavaScript/jQuery using the code below. It pulls the correct events, but the time is always 6:45am regardless of the event's actual time. Any ideas of what I'm doing wrong?

// <script> included in <head>
http://evbdn.eventbrite.com/s3-s3/static/js/platform/Eventbrite.jquery.js


// external JS file, loaded after above script
$(document).ready(function(){

Eventbrite({'app_key': "__ValidKey__"}, function(eb){
    var options = { 'date':"Future",'organizer': "Lamplighters International", "sort_by":"date" };
    eb.event_search( options, function( response ){         
        $("#upcomingEvents").html(eb.utils.eventList( response, eb.utils.eventListRow ));
        console.log( $("#upcomingEvents").html() );
    [ ... ]

One of the events returned displays this (formatted for clarity):

<div class="eb_event_list_item" id="evnt_div_8625628487">
    <span class="eb_event_list_title">
        <a href="http://www.eventbrite.com/e/w100-basic-training-workshop-tickets-8625628487?aff=SRCH">W100 - Basic Training Workshop</a>
    </span>
    <span class="eb_event_list_date">Wed Mar 19 2014</span>
    <span class="eb_event_list_time">6:45am</span>
    <span class="eb_event_list_location">Lamplighters International</span>
</div>

The event should show 11:45am. Here's the EventBrite page: http://www.eventbrite.com/e/w100-basic-training-workshop-tickets-8625628487?aff=SRCH

Était-ce utile?

La solution

Hmmm.... I just replicated your code, and it looks like the eb.utils.eventListRow is spitting out the wrong time. The API is returning the correct start_date value.

My suggestion is to parse the JSON results yourself. Instead of using eb.utils.eventListRow you can get the eb.event_search response as a JSON object:

function getEventbriteEvents() {
  Eventbrite({'app_key': "54XIQ35B73N6UXADDF", 'user_key':"12922547909277245491"}, function(eb){
    eb.event_search( {'date':"Future",'organizer': "Lamplighters International", "sort_by":"date"}, function( response ){
      console.log(response);
    });
  });
}

The response variable will be a JSON object with structure shown here (full result structure in the docs: http://developer.eventbrite.com/doc/events/event_search/):

{
    "events": [{
      "summary": {
        "total_items": 6,
        "first_event": 8625730793,
        "last_event": 8648687457,
        "filters": {
          "organizer": "Lamplighters International"
        },
        "num_showing": 6
    }
  },
  {
    "event": {
      "timezone": "America/Chicago",
      "id": 8625730793,
      "title": "W100 - Basic Training Workshop",
      "start_date": "2014-04-09 11:45:00",
      "end_date": "2014-04-09 13:00:00",
      "timezone_offset": "GMT-0500",
      [...tons more event info...]
    }
  },
    {[...more events...]}
}

Hope that helps you out. Good luck!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top