POST http:// localhost:8080 / something / Login 405(方法不允许)

时间:2015-11-27 08:25:28

标签: javascript java

我试图将一些信息从登录表单发布到我的后端,但是有一条消息405(Method Not Allowed)。有什么想法吗?

       <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);

我的sendRequest方法包含:

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);
}

0 个答案:

没有答案