jQuery doesn't process result
In my script i send data to check if username exists in database, but user
is created anyway. I've checked that controller works fine. Am I
processing the result in a correct way?
My script
var values = $("form").serialize();
$.ajax({
type: "POST",
url: "/checkLogin",
data: values,
success: function(result) {
if (result==false){
login.addClass( "ui-state-error" );
updateTips("login exists");
bValid=false;
}else {
bValid=true;
}}});
Here's my controller
@RequestMapping(value="/checkLogin", method=RequestMethod.POST)
@ResponseBody
public boolean check(@RequestParam("login") String login) {
return (userService.findByLogin(login) == null);
}
No comments:
Post a Comment