Hey. I am trying to parse some JSON into HTML using jQuery. I’ve checked to see if my API request is working, and it is.
I think it gets stuck when appending the HTML.
$('button').click(function(){
$.getJSON('http://api.songkick.com/api/3.0/events.json?apikey=MY_API_KEY&location=ip:94.228.36.39', function(data) {
$('.json').html('<p>' + data.location + '</p>' + '<p>' + data.uri + '</p>');
});
});
getJson
returns loads of data in the following format, but I can’t seem to parse it to HTML.
{
"resultsPage": {
"totalEntries": 99,
"page": 1,
"results": {
"event": [
{
"type":"Concert",
"location": {
"city":"Huddersfield, UK"
,"lng":-1.78333,
"lat":53.65},
"popularity":0.0,
"status":"ok",
"uri":"http:\/\/www.songkick.com\/concerts\/4993456-barbirolli-quartet-at-st-pauls-hall?utm_source=2251&utm_medium=partner",
"venue":{
"uri":"http:\/\/www.songkick.com\/venues\/156338-st-pauls-hall?utm_source=2251&utm_medium=partner",
"lng":-1.78333,
"displayName":"St. Paul's Hall",
"id":156338,
"metroArea": etc......