- ajax "application/json; charset = utf-8", api json.
var basicInfo = JSON.stringify(
{
firstName : playerProfile.firstName(),
lastName : playerProfile.lastName(),
gender : playerProfile.gender(),
address : playerProfile.address(),
country : playerProfile.country(),
bio : playerProfile.bio()
});
$.ajax({
url: "http://localhost:8080/social/profile/update",
type: 'POST',
dataType: 'json',
contentType: "application/json; charset=utf-8",
data: basicInfo,
success: function(data) {
}
});
@RequestMapping(value = "/profile/update", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<ResponseModel> UpdateUserProfile(@RequestBody User usersNewDetails, HttpServletRequest request, HttpServletResponse response){
, , spring , json ajax.
. ajax - "application/x-www-form-urlencoded"