html如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>title> -- <meta http-equiv="refresh" content="2"> -->
<script language="javascript" src="../JS/login.js"></script>
<link rel="stylesheet" href="../CSS/login .css" type="text/css">
</head>
<body onload="Login();">
<div class="main">
&
;div id="myDiv" class="table1box">
<table id="table1" class="table1" border="1px">
<tr>
<th> /th>
<th>msg</th>
<th>认证码</th>
</tr>< <;.
jika (window.XMLHttpRequest) {
xmlhttp = XMLHttpRequest();
} lain {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
== jika (xmlhttp .ready&http status == 200) {
var dataobj = JSON.parse(datastr)
let dataarr = [];
(dataarr.pus ;
}
var table = document.getElementById("table1");
var row = table.insertRow(table.rows.length);
var c1 = row.insertCell(0);
c1.inner 0];
var c2 = row.insertCell(1);
c2.innerHTML = dataarr[1];
c3.innerHTML = dataarr[2];
}
}
}
xmlhttp.open("POST", "https://api.123321yun.com/api/user/login?username=test123&password=123456", true);
xmlhttp.setRequestHeader("Content-type", "application/x -www-form-urlencoded");
xmlhttp.send();
小白求帮忙
1. Tentukan elemen yang hendak dimuat semula, contohnya, id ialah #cont
2. Ajax terus meminta pelayan (logik bahagian belakang ditulis oleh diri sendiri, dalam keadaan apa kandungan perlu dikemas kini)
3. Apabila kandungan baharu diminta, kandungan elemen #cont akan diubah suai
Itulah ideanya