所有涉及的图片、文章、视频等资源版权归原创作者所有。
如果遇见任何问题,请联系我
http://api.kuiwaiwai.com/shici
| 参数 | 说明 |
|---|---|
| text | 内容 |
| author | 作者 |
| from | 出处 |
<p id="juzi">句子获取中</p>——<span id="author">作者获取中</span> 《<span id="from">出处获取中</span>》 <!-- 现代写法,不兼容IE --><script> fetch('http://api.kuiwaiwai.com/shici') .then(response => response.json()) .then(data => { juzi.innerText = data.text author.innerText = data.author from.innerText = data.from }) .catch(console.error)</script> <p id="juzi2">句子获取中</p>——<span id="author2">作者获取中</span> 《<span id="from2">出处获取中</span>》<!-- 老式写法,兼容IE --><script> var xhr = new XMLHttpRequest(); xhr.open('get', 'http://api.kuiwaiwai.com/shici'); xhr.onreadystatechange = function() { if (xhr.readyState === 4) { var data = JSON.parse(xhr.responseText); juzi2.innerText = data.text; author2.innerText = data.author; from2.innerText = data.from; } } xhr.send();</script>古诗词资源来自于网络,已手动校对,若有误处,还请指正。