In my js file, i have an Ext.Ajax.request to remove a user from a table. The most important thing is to send the username. This is my request code:
Ext.Ajax.request({
url: 'deleteUser.html',
method: 'POST',
headers: {'Content-Type': 'text/html'},
waitTitle: 'Connecting',
waitMsg: 'Sending data...',
params: {
username:username
},
scope:this,
success: received,
failure: function(){console.log('failure');}
});
In the firebug i can see the post myapp/admin/deleteUser.html. In the post tab appears username=example.
In the server-side i have a controller which catchs the post:
@RequestMapping(method=RequestMethod.POST, value="/deleteUser")
public @ResponseBody Map<String,String> deleteUserHandler(@RequestParam("username")String username, Model model){
userService.deleteUser(username);
Map<String,String> responseMap = new HashMap<String, String>();
responseMap.put("message", "Success");
return responseMap;
}
if i have @RequestParam("username") i receive a 400 error (Incorrect request) and if i try another ways to get params i get null.
Could anybody help me please?