XMLHttpRequest从php获取数据如何加载到html div和level上
请有人帮我解决这个问题。
我正在使用 XMLHttpRequest 从 php 获取数据作为 json 数组,这是数据。
使用此代码
const API_PATH = 'http://localhost/api/';
window.onload = function(){
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
document.getElementById("all_service").innerHTML = this.responseText;
};
request.open('GET', API_PATH + 'getServices.php');
request.send(null);
}
如何在 div 和级别上加载
<div id="all_service">
<label class="service-name">Service Name</label>
<label class="service-description">description</label>
<label class="service-offers">deals</label>
<img class="service_image" src="img/service1.png">
</div>
please someone help me to solve this problem.
i am getting data with XMLHttpRequest from php as json array, here is the data.
with this Codes
const API_PATH = 'http://localhost/api/';
window.onload = function(){
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
document.getElementById("all_service").innerHTML = this.responseText;
};
request.open('GET', API_PATH + 'getServices.php');
request.send(null);
}
how to load on div and level
<div id="all_service">
<label class="service-name">Service Name</label>
<label class="service-description">description</label>
<label class="service-offers">deals</label>
<img class="service_image" src="img/service1.png">
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论