[英]AJAX POST with express.js - newlines removed
我用于发送请求的脚本:
$(document).on('submit', 'form', function(e) {
var form = e.currentTarget;
console.log($(this).serialize());
$.ajax({
url: form.action,
type: 'POST',
data: $(this).serialize(),
success: function(response) {renderGraph(response);},
error: function() {}
});
e.preventDefault();
});
服务器路由:
app.post("/sendDL", function(request, response) {
var _graph = new graph(request.body.DLCode);
}
使用x=1;y=2;
作为输入,我得到DLCode=x%3D1%3By%3D1%3B
。
使用x=1;\\ny=2;
作为输入,我得到DLCode=x%3D1%3B%0D%0Ay%3D1%3B
。
两者都在request.body.DLcode
产生x=1;y=1
。
有什么建议么?
我是一个完全的假人。
它确实通过了,我在VS2012中进行调试,并且调试器认为换行符并不重要。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.