function sendRequest() { var xhr = Titanium.Network.createHTTPClient(); xhr.onload = function() { if ( this .status == 200 ) { // this becomes true if your request is completed. } }; }; xhr.open( 'POST' , 'http://your_domain.com/test.php' ); xhr.send({ 'data' :data}); xhr.onerror = function() { Titanium.API.info( 'error' ); Titanium.UI.createAlertDialog({title: 'Error ' , message: 'Please check your internet connection' }).show(); }; |