XHR 请求中的 500 内部服务器错误 [英] 500 Internal Server Error on XHR Request
本文介绍了XHR 请求中的 500 内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码:
var fd = new FormData(document.querySelector('#form-step1'));
var xhr = new XMLHttpRequest();
xhr.open('POST', '/Handlers/newAccount_handler.php', true);
xhr.send(fd); // this line is causing a 500 Internal Server Error and the data is not saved to the MySQL table
为什么最后一行会导致 500 Internal Server Error?代码有什么问题吗,还是我需要先登录才能查看?
Why is the last line causing a 500 Internal Server Error? Is there anything wrong with the code or do I need to log anything first to see?
推荐答案
这看起来有点旧,但我也遇到过类似的问题.值得检查您发送的 '#form-step1' 的值.在我的例子中,如果值包含引号,它会抛出一个错误,但使用简单的文本它可以正常工作.
This seems a bit old, but I've had similar issue. It's worth checking what the value of '#form-step1' you are sending. In my case if the value contained quotes it would throw an error, but with simple text it worked fine.
这篇关于XHR 请求中的 500 内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文