0

I'm parsing remote data in to my app and uses it through arguments. One of the data types is a url adresse i want to open in the url. I have an idea that I have to open it with the openURL function but I can't seem to get it to work. Anyone have a working example?

  • Mike, please provide the relevant part of your nonworking code, and the errors you get (if any). See [how-to-ask](https://stackoverflow.com/help/how-to-ask) for details on how to ask a good question. – Patrick De Marta Jun 06 '16 at 07:47

1 Answers1

0

You have to utilize in-built HttpClient

var url = "http://www.you_remote_url.com";

var client = Ti.Network.createHTTPClient({
   // function called when the response data is available
   onload : function(e) {
     Ti.API.info("Received text: " + this.responseText);
     alert('success');
   },
   // function called when an error occurs, including a timeout
   onerror : function(e) {
     Ti.API.debug(e.error);
     alert('error');
   },
   timeout : 5000  // in milliseconds
 });

 // Prepare the connection.
 client.open("GET", url);
 // Send the request.
 client.send();
Zumry Mohamed
  • 9,318
  • 5
  • 46
  • 51