是这样,fir = {“error”:0,“imgBuffer”:{“type”:“Buffer”,“data”:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,…}一串非常长的数据,所以直接Post报错:too large,于是改用formdata,前台JQ代码如下:
var fd = new FormData();
fd.append(‘fir’, fir);
$.ajax({
url: “/threeInOne”,
data: fd,
processData: false,
contentType: false,
type: ‘POST’,
success: function (data) {
var json=JSON.stringify(data)
$("#FPbox_1").append(json)
}, error: function (err) {}});后台nodejs代码如下:
function threeInOne (req,res) {
var a = JSON.stringify(req.form);
console.log (“test:”+a);
}输出结果:test:{}
所以应该是传递值都没有传递成功,fd.append(‘fir’, fir)这句在谷歌F12里是这样的:就是我这样的
...
继续阅读
(103)