I know there are several good quality answers to this question but i'm struggling with the syntax to get it to work with:
$.getJSON( "ticketweb.json",
function(data){
$.each(data.events, function(){
$('ul#listings').append("<li><div class=event-col><span class=name>" +this.eventname+ "</span><p>" +this.eventurl+ "</p><div class=date>" +this.dates.startdate+ "</div><p>" +this.eventimages+ "</p><p>" +this.venue.name+ "</p></div></li>");
});
});
where
<div class=date>" +this.dates.startdate+ "</div>
part of the .append is the bit I'm wanting to format. I've tried numerous methods but not sure how to incorporate the more universal json format methods into the syntax above.
EDIT: Date format i would ideally liek would be: Sat 17th Nov, although 17.11.12 would be ok too.
the output i current get is 20120629100000. There is no forward or backslashes (/Date(1224043200000)/) like I've seen on similar questions, I'm not sure if there is an element of good coding practise I'm missing here. My jSON file is completely valid entered below:
"events": [
{
"eventid": "4419605",
"facebookeventid": "",
"eventname": "",
"description": "",
"eventurl": "",
"additionallistingtext": "",
"status": "SalesEnded",
"tags": "",
"spotifyuri": "",
"dates": {
"startdate": "20120529010000",
"enddate": "20121231235500",
"onsaledate": "20120309084000",
"announcedate": "20120309115333",
"timezone": "EDT"
},
"venue": {
"venueid": "210795",
"name": "Online",
"venueurl": "",
"city": "Online",
"state": "",
"postalcode": "00000",
"country": "US",
"address": "Online",
"twitterid": "",
"venueimages": {
"large": "",
"small": ""
}
},
"eventimages": [""],
"prices": {
"pricelow": "$195.00",
"pricehigh": "$195.00",
"pricedisplay": "$195.00"
},
"attractionList": [
{
"sequence": "0",
"billing": "1.00",
"genre": "Seminar/Lecture",
"links": "",
"media": ""
},
{
"sequence": "1",
"billing": "0.75",
"links": "",
"media": ""
},
{
"sequence": "2",
"billing": "0.75",
"links": "",
"media": ""
}
]
},