我试过这种方式,但提出了错误的请求
var id = localStorage.getItem('sessionId');
$.ajax({
method:'POST',
url:'video/ratings?sessionId='+id+'',
data:{"videoId":"5757e6e41b0a244b256ac1d7","rating":"5"},
success:function(data){
console.log(data);
}
}
);
这些是我用
提供的输入(required)queryurl:/video/ratings?sessionId=CqqAfowuZLzXHyViPaYzzyOU3dGPCFaG input:{"videoId":"5757e6e41b0a244b256ac1d7","rating":"5"}
答案 0 :(得分:0)
尝试下面的代码,这对我有用。
var id = localStorage.getItem('sessionId');
$.ajax({
headers: {'session_id': id}
method:'POST',
url:'video/ratings/',
data:{"videoId":"5757e6e41b0a244b256ac1d7","rating":"5"},
success:function(data){
console.log(data);
}
});
答案 1 :(得分:0)
var id = localStorage.getItem('sessionId');
$.ajax({
method:'POST',
url:'video/ratings?sessionId='+id+'',
data:{videoId:"5757e6e41b0a244b256ac1d7",rating:5},
success:function(data){
console.log(data);
}
}
);