1.如果后台接收参数中使用
@RequestBody
那么
$.ajax({
url:CONTEXT_PATH+"/lotPlatform/getLastState",
type: "post",
contentType:'application/json',
dataType: "json",
traditional:true,
data:JSON.stringify({'deviceName':'hangtian2'}),
success:function(data){
console.log(data);
}
})
2、如果没有
$.ajax({
url:CONTEXT_PATH+"/lotPlatform/getLastState",
type: "post",
contentType: "application/x-www-form-urlencoded",
dataType: "json",
traditional:true,
data:{deviceName:'hangtian2'},
success:function(data){
console.log(data);
}
})