可以看看Express或者koa 直接写nodejs的话的node 下面的代码,ajax中的dataType修改成text,就能请求到 const http = require('http'); const hostname = '127.0.0.1'; const port = 1337; http.createServer((req, res) => { res.writeHead(200, { 'Content-Type': 'text/plain' }); res.end('Hello World\n'); }).listen(port, hostname, () => { console.log(`Server running at http://${hostname}:${port}/`); });
可以看看
Express
或者koa
直接写
nodejs
的话的node
下面的代码,
ajax
中的dataType
修改成text
,就能请求到