如何解决我应该如何对使用 XMLHttpRequest 发送的表单值进行编码
我想知道在将表单值发送到带有 XMLHttpRequest
的 .asp 页面时对表单值进行编码的正确方法是什么,然后在将其插入到我的数据库之前在 .asp 页面上对其进行解码。所以我可以使用这样的字符 #%?´:;!+-'
我是否使用encodeURIComponent(the string value here)
所以假设表单在 page1.asp 中
<form action="#" id="saveuploads" ENCTYPE="multipart/form-data" class="form-ajax-submit">
<input type="text" name="artikel" >
</form>
// lets say I have a string in the form with the value `#%?´:;!+-'`
artikel=encodeURIComponent('#%?´:;!+-'')
fdu.append("artikel",artikel);
var xhr = new XMLHttpRequest();
xhr.open("POST","upload2.asp");
xhr.send(fdu);
然后在page2.asp 我应该用
解码吗artikel=decodeURIComponent(request.form("artikel"))
然后将artikel插入数据库...
感谢任何输入,谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。