1
獨特價值(ID)模態的具體數據我有一個從API
未來的數據集。數據中沒有id屬性。當我們要顯示其ID形式的基礎上,具體的數據,我們在html
聲明data-id
屬性,但如果我們沒有相關數據的任何id
。我們如何在模態中顯示它的內容?如何顯示沒有在PHP
查看我的數據,我正在顯示name
並有more-info
按鈕用於modal
。我應該怎麼做,當有人點擊more-info
按鈕。它顯示具體內容?
還有一個在我怎麼能分頁它在PHP中的數據下一個網址?
{
"count": 37,
"next": "http://some-url/api/stars/?page=2",
"previous": null,
"results": [
{
"name": "Sentinel-class landing craft",
"model": "Sentinel-class landing craft",
"manufacturer": "Sienar Fleet Systems, Cyngus Spaceworks",
"cost_in_credits": "240000",
"length": "38",
"max_atmosphering_speed": "1000",
"crew": "5",
"passengers": "75",
"cargo_capacity": "180000",
"consumables": "1 month",
"hyperdrive_rating": "1.0",
"MGLT": "70",
"starship_class": "landing craft",
"pilots": [],
"films": [
"http://some-url/api/films/1/"
],
"created": "2014-12-10T15:48:00.586000Z",
"edited": "2014-12-22T17:35:44.431407Z",
"url": "http://some-url/api/stars/5/"
},
{
"name": "Death Star",
"model": "DS-1 Orbital Battle Station",
"manufacturer": "Imperial Department of Military Research, Sienar Fleet Systems",
"cost_in_credits": "1000000000000",
"length": "120000",
"max_atmosphering_speed": "n/a",
"crew": "342953",
"passengers": "843342",
"cargo_capacity": "1000000000000",
"consumables": "3 years",
"hyperdrive_rating": "4.0",
"MGLT": "10",
"starship_class": "Deep Space Mobile Battlestation",
"pilots": [],
"films": [
"http://some-url.co/api/films/1/"
],
"created": "2014-12-10T16:36:50.509000Z",
"edited": "2014-12-22T17:35:44.452589Z",
"url": "http://some-url.co/api/starships/9/"
},
你是怎麼得到這個數據?依據是什麼?,你怎麼指標數據進行查詢? – madalinivascu
實際上,我從'API'數據中獲取這些數據的形式是'JSON' –
您的db似乎有一個唯一的關鍵字,與我在urls中看到的特定值關聯,爲什麼不從服務提供商呢? – madalinivascu