我有一个我正在使用的API,它会返回一个包含20个左右事件的列表。我需要能够在我的网站的各个位置显示不同的事件,有时在多个地点显示相同的事件。事件的显示在各个点之间被分解,因此在表格中显示不起作用。我在SO和其他地方所做的大部分研究都向我展示了一个数据被返回并显示在标题标签或p标签中的示例,或者它向我展示了如何显示所有返回的信息。单桌。
我得到的数据每个事件大约有50个值,大约有20个事件。
我只需要显示每个事件返回的几个值。
以下是返回的值:
[
{
"id": "98",
"onSale": "1",
"cutOff": 1591059600,
"eventType": "typedTickets",
"venue": "Venue",
"notOnSaleText": "",
"location": "",
"location2": "",
"title": "title",
"start": 1429754400,
"end": 1591068600,
"description": "description",
"shortDescription": "",
"sefUrl": "example",
"largePic": "url",
"smallPic": "url",
"perItemReplacement": "",
"quantityReplacement": "",
"h1AndTitle": "h1 and title",
"startDateFormat": "",
"endDateFormat": "",
"categories": [],
"buttonText": "Buy",
"startFormatted": "",
"endFormatted": "",
"closed": 0,
"elapsed": 0,
"capacity": 0,
"soldOut": 0,
"eventStatus": 1,
"images": [],
"videos": [],
"contentPages": [],
"customFields": {
"customConfirmationOn": "0",
"customConfirmationText": "",
"detailLayout": "2",
"externalEventId": "id",
"promoCodeRequired": "",
"shippingCutoff_2": "",
"showCutoffDate": "0",
"showPostalCode": "0",
"showVenueAddress1": "1",
"showVenueAddress2": "0",
"showVenueCity": "1",
"showVenuePostalCode": "1",
"showVenueState": "1",
"timezone": "America/Los_Angeles",
"venueAddress1": "street",
"venueAddress2": "",
"venueCity": "city",
"venuePostalCode": "postalcode",
"venueState": "state"
},
"waveTimes": [],
"ticketTypes": [
{
"id": "id",
"name": "name",
"description": "description",
"price": 26.5,
"eventId": "id",
"soldOut": false,
"remaining": 10000
},
{
"id": "id",
"name": "name",
"description": "",
"price": 0,
"eventId": "98",
"soldOut": true,
"remaining": 0
}
],
"addToCartForm": "form"
},
基本上,我需要在其中显示shortDescription,smallPic,buttonText和price。而且,我需要能够逐个显示每个事件,而不是在表格或列表中。
可悲的是,这是迄今为止我能够制作的唯一代码:
$.ajax ({
url: 'myurl/api/eventFeed',
type: "POST",
dataType: "json",
});
任何人都可以帮助我,或者指点我的教程方向吗?