- 获取在线网站数据
基本所有网站都使用Ajax,在F12的Network选项中,选择XHR,找到json数据后,百度一个在线转化json格式,后复制进自己的json文档中即可
- php读取json后返回index页面
index文档:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>index</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jqueryMin.js"></script>
<script src="js/bootstrap.min.js"></script>
</head>
<style>
p{
font-size: 20px;
}
table{
width: 1000px;
height: 300px;
border: 1px pink solid;
margin-left: 300px;
background-color: pink;
}
table td{
margin: 2px;
border:1px solid skyblue ;
border-radius: 5px;
text-align: center;
line-height:;
}
</style>
<body>
<button>获取json数据</button>
<div class="display"></div>
<script>
$('button').on('click',function () {
var jjson=new XMLHttpRequest();
jjson.open('post','hello.php');
jjson.setRequestHeader('Content-type','application/x-www-form-urlencoded');
jjson.onreadystatechange=function (