Created
October 3, 2011 19:55
-
-
Save jonalter/1260060 to your computer and use it in GitHub Desktop.
Test setRequestHeader
This file contains hidden or 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
| var win = Ti.UI.createWindow({ | |
| backgroundColor : 'white', | |
| fullscreen : true | |
| }); | |
| var button = Ti.UI.createButton({ | |
| title : 'test', | |
| height : 60, | |
| width : 200 | |
| }); | |
| win.add(button); | |
| button.addEventListener('click', function(e) { | |
| var xhr = Titanium.Network.createHTTPClient(); | |
| xhr.open('GET', 'http://10.0.15.101/~jalter/test/index.php'); | |
| xhr.onerror = function(e) { | |
| alert(e.error); | |
| Ti.API.info('error: '+e.error); | |
| }; | |
| xhr.setTimeout(200000); | |
| xhr.onload = function(e) { | |
| Ti.UI.createAlertDialog({ | |
| title : 'Success', | |
| message : this.responseText | |
| }).show(); | |
| Ti.API.info('onload: '+this.responseText); | |
| }; | |
| xhr.onsendstream = function(e) { | |
| Ti.API.info(e); | |
| }; | |
| xhr.setRequestHeader('Content-Type','application/json'); | |
| xhr.send(); | |
| }); | |
| win.open(); |
This file contains hidden or 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
| <?php | |
| $headers = apache_request_headers(); | |
| foreach ($headers as $header => $value) { | |
| echo "$header: $value <br />\n"; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment