我在JSON文件中包含了大量的值,其中包含場地名稱和他們的聯繫信息以及描述。我想生成一個表格,其中列出了我的頁面上的JSON文件的內容。我希望創建一個實時搜索功能,刪除與檢測到的每個keyUp
不再相關的每個條目。jQuery,JSON,搜索等
的JSON
[
{
"name": "Aquarium Café Bar",
"site": "http://www.aquariumcafebar.ca",
"address": "2923 Masson 728-6116",
"genre": "default"
},
{
"name": "Aréna Pierre “Pete” Morin",
"site": "none",
"address": "1925 St-Antoine 634-3471",
"genre": "default",
}
]
提出的HTML
<table>
<thead>
<tr>
<th>Venue</th>
<th>Address</th>
<th>Website</th>
<th>Genre</th>
</tr>
</thead>
<tbody>
<tr>
<td>Aquarium Café Bar</td>
<td>2923 Masson 728-6116</td>
<td>http://www.aquariumcafebar.ca</td>
<td>Rock</td>
</tr>
</tbody>
</table>
我得如何從jQuery中的venues.json文件搶JSON一個模糊的想法,但一旦我將它包含到.append()中包含所有信息,我真的不知道該如何處理它。我只是在這裏尋找一些有關語法的幫助!
噢,如果您碰巧有任何關於如何在用戶搜索時更新表格的明智想法,它將不勝感激!
愛,
BenjiBee
小挑剔:這不是有效的JSON語法,因爲密鑰中沒有報價。 – 2010-08-18 00:49:23
謝謝,更正。 – Benji 2010-08-18 00:52:43
你爲什麼不嘗試你正在做的事情,從那時起我們可以幫助你? – 2010-08-18 00:55:46