使用ajax请求示,laravel框架接参时,没有接到空值,但postman请求时空值拿到了,于是对ajax请求做了设置
$.ajax({
url:"url",
method:'post',
//如果不以json方式请求,请示时会过滤掉空值
/*contentType: 'application/json',
data:JSON.stringify(data),*/
//普通方式请求数据
//data:data,
dataType:'JSON',//返回值类型
success:function(res){
//console.log(res)
},
error:function (res) {
}
})
: