【发布时间】:2019-03-31 22:20:54
【问题描述】:
我正在尝试发送JQuery 请求,但我无法在使用Express 编写的服务器中将它们发送出去。
现在,我正在尝试以这种方式发送数据:
客户端
$.post('http://localhost:8080/numberOfAnsweres',{'val': 2})
服务器端
app.post('/numberOfAnsweres',(req,res,next)=>{
numberOfAnwers = req.??????
console.log(numberOfAnwers)
})
我不知道应该使用req 的哪个参数。
我也不确定发送方式好不好,有没有更好的方法?
【问题讨论】:
-
你签入快递文档了吗?通常是最好的起点
标签: javascript jquery express httprequest