I've been using XMLHTTPRequest first, but I have tried using jQuery Ajax. Keeps the same error. Used chrome://inspect to inspect my phone and in the console shows this:
GET https://freecurrencyapi.net/api/v2/latest?apikey=my-key&base_currency=EUR 404 (Not Found)
The code for XMLHTTPRequest:
function getJSON(url) {
var http = new XMLHttpRequest();
http.open("GET", url, false);
http.send(null);
return JSON.parse(http.responseText);
}
The code for jQuery Ajax:
`
$.ajax({
type: "GET",
url: "https://freecurrencyapi.net/api/v2/latest?apikey=my-key&base_currency=" + from_val
}).done((data) => {
to_box.value = data.data[to_val] * parseFloat(from_box.value);
});
`
Please tell me what to do. thank you.