Stack Exchange
POST http://localhost:8080/something/Login 405 (Method Not Allowed)
I,m trying to post some info from login form to my back end, but there is a message 405 (Method Not Allowed). Any ideas?
       <a>Login</a>
       <ul id="info">
          <li>
             <p><input type="email" name="log_email" id="log_email" class="shortput" onfocus="if(this.value == 'Email address') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Email address'; }" value="Email address" /></p>
             <p><input type="password" name="log_password" id="log_password" class="shortput" onfocus="if(this.value == 'Password') { this.value = ''; }" onblur="if(this.value == '') { this.value = 'Password'; }" value="Password" /></p>
             <p><input type="button" id="logincustomer" value="Login"/></p>
          </li>
       </ul>

sendingData();
values = "log_email=" +  encodeURI(document.getElementById("log_email").value);
values += "&log_password=" + encodeURI(document.getElementById("log_password").value);

sendRequest("Login",values);
xmlHttpTimeout = setTimeout(onTimeoutLoginCustomer,10000);

My sendRequest method contains:
function sendRequest(url, data) {
    ajaxRequest = createAjaxRequest();
    ajaxRequest.open("POST", url, true);
    ajaxRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded‌​; charset=UTF-8");
    var date = new Date();
    data += "&timestamp=" + date.getTime();
    ajaxRequest.send(data);
}


Maybe you have a typo in the value of the method attribute of your form tag?

are those input fields in a form?

Method not allowed means that you use a method (like POST or GET), which is not allowed. Login usually uses POST, so maybe you are not sending it as POST?

it's not in a form..

It does not need to be if you send it via Ajax.

function sendRequest(url,data) {
ajaxRequest = createAjaxRequest();
ajaxRequest.open("POST", url, true);
ajaxRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
var date = new Date();
data += "&timestamp=" + date.getTime();
ajaxRequest.send(data);
}

If you use Chrome, press F12, go to the Network tab and try it again, does it say what method it is sent with? Also check the Allow response-header. That should say what methods are allowed.

Your backend is expecting GET request. Check with backend provider.
