这是我的代码,我想发送请求,网址很有用
var go_login;
go_login = function(e) {
var params, xhr;
xhr = Ti.Network.createHTTPClient();
xhr.open("post", Setting.server+"/interface/about_us");
xhr.onload = function() {
console.info(this.responseText);
if (this.status === "200") {
console.info("successful");
} else {
console.info(this.status + "--------------------" + this.response);
}
};
xhr.onerror = function(e) {
console.info(e.error);
};
params = {
mobile_phone: $.login_phone.value,
password: $.login_password.value
};
return xhr.send(params);
};
这是我的错误:
[ERROR] TiHttpClient:(TiHttpClient-1)[5706,6457] HTTP错误(org.apache.http.client.HttpResponseException):错误请求 [错误] TiHttpClient:org.apache.http.client.HttpResponseException:错误请求 [错误] TiHttpClient:at ti.modules.titanium.network.TiHTTPClient $ LocalResponseHandler.handleResponse(TiHTTPClient.java:275) [错误] TiHttpClient:at ti.modules.titanium.network.TiHTTPClient $ LocalResponseHandler.handleResponse(TiHTTPClient.java:219) [错误] TiHttpClient:at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657) [错误] TiHttpClient:at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637) [错误] TiHttpClient:at ti.modules.titanium.network.TiHTTPClient $ ClientRunnable.run(TiHTTPClient.java:1329) [错误] TiHttpClient:在java.lang.Thread.run(Thread.java:856)
我不知道为什么会有错误的请求
答案 0 :(得分:0)
我刚刚解决了问题,将“post”替换为“POST”,然后就可以了