html获取网络数据,列表展示
js遍历json数组中的json对象
image.png
|| '-' 判断数据是否为空,为空就显示 -
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>网页列表</title>
</head>
<body>
<div>
<div style="width: 100px; height: 100px;" id="myDiv"></div>
</div>
<script type="text/javascript">
// https://api.thecatapi.com/v1/images/search?limit=2
//
// {
// "id": "1ep",
// "url": "https://cdn2.thecatapi.com/images/1ep.jpg",
// "width": 448,
// "height": 674