阿贾克斯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