[英]Unexpected token J in JSON at position 0 at JSON.parse (<anonymous>) at __webpack_exports__.default (webpack-internal:///./pages/api/mail.js:4:21)
I don't understand what is wrong here or what's causing the problem我不明白这里有什么问题或导致问题的原因
I'm trying to build a contact form here and when I console.log() the FormData here it returns an empty array and gives Internal Server error 500
check out the error here .我正在尝试在此处构建联系表单,当我在此处使用console.log() FormData 时,它会返回一个空数组并给出
Internal Server error 500
请在此处查看错误。 I'm posting a link because it does allow me to share a pic since I've low reputation.我发布链接是因为它确实允许我分享图片,因为我的声誉很低。
My pages/contact.js contains data of a POST REQUEST of the input fields code我的 pages/contact.js 包含输入字段代码的POST REQUEST数据
Finally error in my IDE's terminal最后在我的 IDE 终端中出错
Your are passing the JSON.stringify
string as the data.您将
JSON.stringify
字符串作为数据传递。 You are not calling the JSON.stringify
method.您不是在调用
JSON.stringify
方法。 And you also need to use parenthesis when you call it, not brackets.并且在调用时还需要使用括号,而不是方括号。
the body: "JSON.stringify[formData]"
body: "JSON.stringify[formData]"
to body: JSON.stringify( formData )
到
body: JSON.stringify( formData )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.