Every time I attempt to retrieve information from a JSON file, I encounter an error.
function search(e){
var url = 'https://www.dotscancun.com/createjson.php?id=100001';
var xhr = Ti.Network.HTTPClient({
onerror: function(e){
Ti.API.info(this.responseText);
Ti.API.info(this.status);
Ti.API.info(e.error);
},
timeout: 5000
});
xhr.open('GET',url);
xhr.send();
xhr.onload = function(){
var json = JSON.parse(this.responseText);
alert(json);
};
};
This is the code snippet causing the issue.
The specific error message reads as follows:
[LiveView] Client connected
[ERROR] : TiHTTPClient: (TiHttpClient-8) [1340,1340] HTTP Error (java.io.IOException): 404 : Not Found
[ERROR] : TiHTTPClient: java.io.IOException: 404 : Not Found
[ERROR] : TiHTTPClient: at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1217)
[ERROR] : TiHTTPClient: at java.lang.Thread.run(Thread.java:818)
A 404 error indicates that the website does not exist. However, if you directly paste the URL into your browser, it works fine. What could be causing this discrepancy?