1

如何将参数添加到titannum中的url

var xhr = Ti.Network.createHTTPClient();

用户名和密码

abcd 是用户名 abcd@123 是密码

var authstr = 'Basic ' +Titanium.Utils.base64encode('abcd'+':'+ 'abcd@123'); 
xhr.setRequestHeader('Authorization', authstr);   

xhr.open("GET","http:\\domain name .. .. ");
    alert (xhr.open);
Ti.API.info("result " + xhr);

我需要用用户名和密码附加我的网址!

我需要在titannum中打印总网址!

4

1 回答 1

0

I generally create the url by concatenating the params into the url like this..

  var api_url = "http://domain/?paramname=" + param + '&paramname2=' + param2;

  xhr.open('GET', api_url);
  xhr.send();

where param and param2 are variables holding the proper data

于 2012-12-03T01:23:14.423 回答