Advertisement
Guest User

Untitled

a guest
Oct 4th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. @RequestMapping(value = "/validate", method = RequestMethod.POST)
  2. @ResponseBody
  3. public ModelAndView(HttpServletRequest request, HttpServletResponse response, Model model) {
  4. String userName = request.getParameter("userName");
  5. String password = request.getParameter("password");
  6. boolean validuser=employeeService.checkLogin(userName,password);
  7. if(validuser == true)
  8. {
  9. model.setViewName("success");
  10. return model;
  11. }
  12. model.setViewName("login");
  13. return model;
  14. }
  15.  
  16. $(document).ready(function() {
  17. $("form").submit(function() {
  18. var userName=$("#inputEmail").val();
  19. var password=$("#inputPassword").val();
  20. $.ajax({
  21. type : "post",
  22. url : "${pageContext.request.contextPath}/validate",
  23. data : {userName:userName, password:password},
  24. success:function(data){
  25. alert(data);
  26. },
  27. error:function()
  28. {
  29. alert("Error ");
  30. }
  31. });
  32. });
  33. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement