Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(value = "/validate", method = RequestMethod.POST)
- @ResponseBody
- public ModelAndView(HttpServletRequest request, HttpServletResponse response, Model model) {
- String userName = request.getParameter("userName");
- String password = request.getParameter("password");
- boolean validuser=employeeService.checkLogin(userName,password);
- if(validuser == true)
- {
- model.setViewName("success");
- return model;
- }
- model.setViewName("login");
- return model;
- }
- $(document).ready(function() {
- $("form").submit(function() {
- var userName=$("#inputEmail").val();
- var password=$("#inputPassword").val();
- $.ajax({
- type : "post",
- url : "${pageContext.request.contextPath}/validate",
- data : {userName:userName, password:password},
- success:function(data){
- alert(data);
- },
- error:function()
- {
- alert("Error ");
- }
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement