1.建立 ajax-mongo.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div>ajax</div>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script>
function test(){
$.ajax(
{
url:"/getdata",
type:'get',
dataType:"json",
success:function(data){
console.log("ok");
console.log(data)
},
error:function(error){
console.log(error)
}
})
}
test()
</scr