Java Web uses AJAX POST Method 405 terror [Solved]

xmlHttp.open('post', './UserServer', true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send("type=1&userId=" + userId);
//Send() method will also report 405 if the wrong parameter is passed, such as missing '=' or '&' or setRequestHeader("Content-type", "application/x-www-form-urlencoded")

Read More: