我正在使用 Titanium Studio,我必须向 Couchdb 发出 HTTP 获取请求。这是我的代码:
var url ="http://192.168.0.152:5985/hello_world/00a271787f89c0ef2e10e88a0c0001f4";
var json;
var xhr = Ti.Network.createHTTPClient({
onload: function() {
Ti.API.info("Received text: " + this.responseText);
json = JSON.parse(this.responseText);
},
onerror: function(e) {
Ti.API.debug("STATUS: " + this.status);
Ti.API.debug("TEXT: " + this.responseText);
Ti.API.debug("ERROR: " + e.error);
alert('There was an error retrieving the remote data. Try again.');
},
timeout:5000
});
xhr.open("GET", url);
xhr.send();
操作进入超时..