Created
April 16, 2015 12:57
-
-
Save rajubd49/d23cb840de7d9919c677 to your computer and use it in GitHub Desktop.
GET and POST special characters to server - Appcelerator Titanium
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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