简体   繁体   English

JSON.parse 位置 0 处的 JSON 中的意外标记 J (<anonymous> ) 在 __webpack_exports__.default (webpack-internal:///./pages/api/mail.js:4:21)

[英]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 终端中出错

my terminal error我的终端错误

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.

相关问题 未捕获的SyntaxError:JSON.parse中位置0的JSON中的意外标记a( <anonymous> ) - Uncaught SyntaxError: Unexpected token a in JSON at position 0 at JSON.parse (<anonymous>) SyntaxError: Unexpected token = in JSON at position 11 at JSON.parse (<anonymous> )</anonymous> - SyntaxError: Unexpected token = in JSON at position 11 at JSON.parse (<anonymous>) SyntaxError:JSON中的意外令牌u在JSON.parse( <anonymous> ) - SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) 未捕获到的SyntaxError:JSON中的意外令牌&lt;在JSON.parse位置0处( <anonymous> ) - Uncaught SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) Uncaught SyntaxError: Unexpected token & in JSON at position 1 at JSON.parse (<anonymous> )</anonymous> - Uncaught SyntaxError: Unexpected token & in JSON at position 1 at JSON.parse (<anonymous>) 未捕获的语法错误:JSON 中的意外令牌 u 在 JSON.parse 的 position 0 处(<anonymous> ) at./src/context/AuthContext.js</anonymous> - Uncaught SyntaxError: Unexpected token u in JSON at position 0 at JSON.parse (<anonymous>) at ./src/context/AuthContext.js Vanilla JS Unexpected token A in JSON at position 141 json.parse() - Vanilla JS Unexpected token A in JSON at position 141 json.parse() 具有JSON.parse的JSON中位置0处的意外令牌&lt; - Unexpected token < in JSON at position 0 with JSON.parse JSON 中的意外令牌 a 在 position 0 在 JSON.parse - unexpected token a in JSON at position 0 at JSON.parse 未捕获到的SyntaxError:JSON中的意外令牌&lt;在JSON.parse的位置2 <anonymous> )在对象上。 <anonymous> (userhistory.js:23) - Uncaught SyntaxError: Unexpected token < in JSON at position 2 at JSON.parse (<anonymous>) at Object.<anonymous> (userhistory.js:23)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM