Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Calling web service returns "Can't reach host" twice.

$
0
0

I have called following function on a button click. But while running it on mobile web browser, i got response first in 'onload' function and 'success' message is shown. There after it enters to 'onerror' function twice and error message 'Can't reach host' is shown twice. Can anyone help me for solving this issue.

function CallLoginService() {

var url = "https://www.facebook.com/amazonwebservices";
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) {
    alert(e.error);
     Ti.API.debug(e.error);
 },
 timeout : 5000  // in milliseconds

});

// Prepare the connection.

client.open("GET", url);

// Send the request.

client.send();

}


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>