Skip to content

Instantly share code, notes, and snippets.

@rajubd49
Created April 16, 2015 12:57
Show Gist options
  • Save rajubd49/d23cb840de7d9919c677 to your computer and use it in GitHub Desktop.
Save rajubd49/d23cb840de7d9919c677 to your computer and use it in GitHub Desktop.
GET and POST special characters to server - Appcelerator Titanium
//How to GET and POST special characters to server
var win=Titanium.UI.createWindow({
backgroundColor:'#fff'
});
var lbl = Titanium.UI.createLabel({
top:10,
width:300,
left:10,
height:'auto'
});
win.add(lbl);
// XHR GET
var xhr = Titanium.Network.createHTTPClient();
xhr.onload = function()
{
Ti.API.info('in utf-8 onload for GET');
lbl.text = this.responseText;
};
xhr.onerror = function()
{
Ti.API.info('in utf-8 error for GET');
};
xhr.open("GET","http://api.appcelerator.net/p/v1/echo");
//xhr.open("POST","http://api.appcelerator.net/p/v1/echo");
xhr.send({"a":"€漢字Ãéè"});
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment