当前位置:网站首页>请求对象,发送请求
请求对象,发送请求
2022-06-26 02:50:00 【小菜鸟码住】
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<ul id="list">
</ul>
<script>
//https://api.apiopen.top/musicRankings
//ajax
// 1.创建请求的对象
var xhr = new XMLHttpRequest();
var list = document.getElementById('list');
//2.发送请求
xhr.open('get','https://api.apiopen.top/musicRankings',true);
xhr.send();
//3.监听状态
xhr.onreadystatechange = function(){
if(xhr.readyState==4&&xhr.status==200){
var data = JSON.parse(xhr.responseText);
console.log(data);
for(var i=0;i<data.result.length;i++){
list.innerHTML += '<li>'+data.result[i].name+'<img src='+data.result[i].pic_s210+'></li>' ;
}
}
}
console.log(111);
</script>
</body>
</html>

边栏推荐
- 计组笔记——CPU的指令流水
- Stm32cubemx: watchdog ------ independent watchdog and window watchdog
- Learn from Taiji makers - mqtt (V) publish, subscribe and unsubscribe
- 工作室第3次HarmonyOS培训笔记
- 【QT】自定义控件-开关
- Butterknife unbinder uses flashback in fragment and viewpager
- Analysis and optimization of ue5 global illumination system lumen
- Add console programs in UE
- 工业机器人之“慧眼”——机器视觉
- 力扣(LeetCode)175. 组合两个表(2022.06.24)
猜你喜欢
![[solution] the blue screen restart problem of the virtual machine started by the VMware of Lenovo Savior](/img/c3/892ce2f45abea7140df98cabc1431b.png)
[solution] the blue screen restart problem of the virtual machine started by the VMware of Lenovo Savior

Gd32 ADC acquisition voltage

ORB-SLAM3论文概述

【解决】联想拯救者vmware启动虚拟机蓝屏重启问题

Learn from Taiji makers - mqtt (V) publish, subscribe and unsubscribe

培育项目式Steam教育理念下的儿童创造力

Analysis on the diversification of maker space mechanism construction

Add console programs in UE

Review of the paper: unmixing based soft color segmentation for image manipulation

《你不可不知的人性》经典语录
随机推荐
Hardware creation principle of campus maker space
路由跳转之点击列表的操作按钮,跳转至另一个菜单页面并激活相应的菜单
The difference between like,%, - in database query SQL
分布式电商项目 谷粒商城 学习笔记<3>
Cox regression model
Network PXE starts winpe and supports UEFI and legacy boot
工作室第3次HarmonyOS培训笔记
论文回顾:Unmixing-Based Soft Color Segmentation for Image Manipulation
2021-08-04
jupyter notebook的插件安装以及快捷键
经典模型——ResNet
【解决】CMake was unable to find a build program corresponding to “Unix Makefiles“.
Camtasia 2022全新版超清錄制電腦視頻
Is it safe to open an account in flush online? How to open a brokerage account online
我在中山,到哪里开户比较好?网上开户是否安全么?
P2483-[模板]k短路/[SDOI2010]魔法猪学院【主席树,堆】
Record a torture bug caused by restcontrol and controller
Create a nonlinear least squares test in R
解析创客空间机制建设的多样化
【解决】联想拯救者vmware启动虚拟机蓝屏重启问题