前端代码
const api = "http://localhost:8080/index.do"
const headers = {
'Content-Type': 'text/plain',
'Access-Control-Allow-Origin':'*'
}
const num=0
getCourses = (num) =>
fetch(`${api}`, {
method: 'POST',
headers: {
...headers,
'Content-Type': 'application/json'
},
mode: 'cors',
body: JSON.stringify({ num })
}).then(res => res.json())
.then(data => data)
getCourses(num)
后端代码
为何后端总是接受不到请求的参数,Required String parameter 'num' is not present,各位大神帮忙解决一下啊
哔哔one
qq_笑_17
相关分类