ajax xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState === 4 && xmlhttp.status === 200) { if (xmlhttp.responseText) { alert(' 驗證成功') } } } xmlhttp.open('POST', 'http://localhost:3000/e', true) xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded') xmlhttp.send(data) alert(data.email)koa2router.post('/e', async (ctx, next) => { var name = ctx.request.body.email || ''; ctx.response.set("Access-Control-Allow-Origin", '*'); ctx.response.body = '用戶名或密碼錯誤'; console.log(name); });已經(jīng)確定服務(wù)器端正確接受了請求 但是接收到的狀態(tài)碼是404這是什么原因?
使用koa接受post請求報錯404 這是什么原因
猛跑小豬
2019-02-13 17:15:56