JSON的位置:http://fooda.website/data_smaller.jsonJSON的問題,並實施一些現有的JavaScript到這個爛攤子
拼命地把這個JSON到一個表中的HTML,但也讓我來接我想要的特定對象(一些陣列具有在最終標記中不需要的對象)。
使用的代碼從這裏用「jput」:如果Parsing JSON objects for HTML table
不知道問題出在JSON或代碼,但沒有顯示當我加載頁面。
這裏是我的代碼:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="jquery-1.12.3.min.js" type="text/javascript"></script>
<script src="jput.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<script>
$(document).ready(function(){
var json = [];
//while running this code the template will be appended in your div with json data
$("#tbody").jPut({
jsonData:json,
ajax_url:"data_smaller.json",
name:"tbody_template",
});
});
</script>
<table jput="t_template">
<tbody jput="tbody_template">
<tr>
<td>{{First Name}}</td>
<td>{{Middle Name}}</td>
</tr>
</tbody>
</table>
<table>
<tbody id="tbody">
</tbody>
</table>
<script src="jquery.min.js"></script>
<script src="jput.min.js"></script>
</body>
</html>
只想代碼以顯示一個結果,也有一個按鈕,找到一個隨機排列和顯示。 最終產品是當按下時發現隨機數組並僅顯示特定對象的按鈕。
通過每一個可以想象的SO帖子,但我缺乏知識真的讓事情變得艱難,所以現在變得非常絕望。
幫助!
謝謝你......這個社區很棒。
'nothing displays' - 在控制檯中怎麼樣?另外,你正在加載jquery(也許是兩個不同版本)和jput兩次 - 和「XHTML 1.0 Transitional」 - 真的嗎? –