阿賈克斯POST數據我想提出一個POST請求如下:在請求帕拉姆
$.ajax({
url :"/clientCredentials.json",
type: "POST",
data: {
"clientEmail": email,
"clientName":clientName,
"orgName":orgName,
"logoURL":logoURL,
"redirectURI":redirectUri
},
success: function(response){
alert("sucess");
},
error:function(response){
alert("something went wrong");
}
});
在服務器上,我使用@RequestParams得到這個數據。
@RequestParam String clientEmail, @RequestParam String clientName, @RequestParam String orgName, @RequestParam String logoURL, @RequestParam String redirectURI
我從服務器獲取如下:
{"code":"400","errorMessage":"Required String parameter 'clientEmail' is not present"}
如果我使用@RequestBody而不是@RequestParam接受這個數據其工作的罰款。
我的問題是如何在請求參數中獲取這些數據?我究竟做錯了什麼? 我也試過jquery($。get(),$ .post())。沒有工作。
感謝您的任何幫助。
你可以在你的瀏覽器開發工具中看到它。在Chrome上,這是在網絡選項卡下。 我不能幫你關於spring和@RequestParams,但jQuery。 – Loenix
謝謝,@Loenix。我知道了。有些東西在我的服務器配置中是錯誤的。 – Suraj