mounted:function () {
var newServer=JSON.stringify(this.toServer);
$.ajax({
url:'/Add',
type:'post',
data: newServer,
dataType:'json',
crossDomain: true,
contentType : 'application/json',
processData : false,
success:function (rel) {
console.log(rel);
},
error:function (rel) {
console.log(rel);
}
})
}
为什么这个传给data的newServer不加{}就会报500 (Internal Server Error)?
传过去的数据不是标准的json吧你打出来看了吗。500是服务器没解出来你的参数。