Currently I am using AJAX
to request a simple JSON
response from an external API. The problem is, that the API key is exposed. I'm aware the best method is to process this through admin-ajax
and set call the url through PHP. What is the most secure method to do this, and how can this be requested through PHP?
$.ajax({
type: "GET",
url: "https://link.to/api/v2/link?time=day&key=(APIKEYHERE)&response_type=json",
data: dataString,
dataType: "json",
//if received a response from the server
success: function(response) {
console.log(response);
},
});