I have a restful project in spring mvc that use in it jquery code.when my project is restful,all code in jquery not working but when it is not restful all jquery code run correctly.
this is my jquery code.
function doAjaxPost() {
// get the form values
$.ajax({
type: "POST",
url:"/login.htm",//note in restful url change to
*** http://localhost:8080/myproject/login ***
data: "username=" + username + "&password=" + password,
success: function(response){
// we have the response
if(response.status == "SUCCESS"){
//++++++++++
}else{
//++++++++++
}
}
},
});
}
and my controller code is this:
@RequestMapping(value="/login.htm",method=RequestMethod.POST)
public @ResponseBody JsonResponse login(@ModelAttribute(value="user") User user) {
//==============================
}
this code run correctly but when it change to restful not working. what is my code problem?