Error missing content-type header status 415
//ajax提交
$.ajax({
url:'/pics',
type: 'POST',
data:'{"upload":true}',
dataType:'json',
success:function(data){
alert('success');
},
error:function(err){
alert(123);
}
})
调用路由下的js router.post('/pics',function(){
....
res.json({//json串});
})
执行后就一直提醒
unsupported content-Type status 415
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你添加一下content-type?
这句话是提示你找不到content-type
上代码看看,这个错我也见过,忘记代码什么样了
最后发现把
$.ajax
换成
XMLHttpRequest()的形式就可以了。