

$.ajax({ type : 'get', url : './login.php', data : { 'id' : $('#id')[0].value, 'pwd' : $('#pwd')[0].value }, success : function (data) { $('#content').html(data); } });
// fetch post请求在method后面加上header "Content-type" : "application/x-www-form-urlencoded" // 数据写在body中 fetch('https://tujiaweiweb.github.io/Web/user.json?name=' + name.value + '&pwd=' + pwd.value, { method : 'get', }).then(function suc(res) { console.log(res); res.json(function () { }).then(function suc(res) { for(var i = 0; i < res.length; i++) { console.log(res[i]['id'], res[i]['pwd']); } }, function fail() { console.log('fail'); }); });