I have a createHTTPClient that calls a URL and after calling the xhr.send(); it immediately returns before the onload/error is called and the response is checked. Is there a way to make the xhr.send() not return until these functions have completed their tasks and I have some data to return? The async flag (true/false) in the xhr.open does not seem to make a difference.
function getData() { var xhr = Titanium.Network.createHTTPClient(); xhr.onload = function() { ... } xhr.error = function(e) { ... } xhr.open('GET', 'http://www.google.com',true); xhr.send(); };