Forgive me--i'm not an expert developer, but I'm trying to pull in Seatgeek data to my website using their API platform. I found simple code which basically gets me what I need here --http://jsfiddle.net/wgxMH/2/
So I took the javascript, put in a file with extension .js (code as follows)
$.ajax({
// You need to use the callback param for JSONP support so that this works across sites
url: 'http://api.seatgeek.com/2/events?q=boston-celtics&callback=fireEvent',
success: function(data) {
var events = [];
// Make your html for the events table
$.each(data.events, function (i, evt) {
events.push([
'<tr>',
'<td>' + evt.datetime_local.split('T', 1).join("") + '</td>',
'<td><a href="' + evt.url + '">' + evt.title + '</a><br />' + evt.venue.name + '</td>',
'<td><a href="' + evt.url + '" class="btn">Buy Tickets</a></td>',
'</tr>'
].join("
"));
});
console.log(events);
$(".events").append(events.join("
"));
},
dataType: 'jsonp'
});
Then I called the JS in the head of my page where I need it.
But I know there's something missing in order to get it on my actual page (since it isn't working) but i'm not really sure how to get it to work.
I tried this.
<table class="events table table-bordered table-striped table-hover">
<script>
(data)();
</script>
</table>
But not working. Am i even close?