I'm new to wordpress and I have little coding knowledge.I wanted to get few data from external API and display those data in my wordpress site html area.
here is external API: https://www.hpb.health.gov.lk/api/get-current-statistical
API contains lot of details.I dont want all of them.I just need 4,5 of them.. (eg:local_new_cases,update_date_time,local_total_cases,local_deaths,local_recovered) here is the details :https://www.hpb.health.gov.lk/en/api-documentation
here is external web site :https://www.hpb.health.gov.lk/en
I created some code by using stackoverflow,but I don't know how to parse few data into my html area.some tutorial teaching button event.I'dont want button click event.
I have created below code:(It means ,I took data from API )
var data;
$( document ).ready(function() {
getHealthData();
});
/**
*Gets data from API
**/
function getHealthData(){
$.ajax({
type : "GET",
dataType : "json",
url : "https://www.hpb.health.gov.lk/api/get-current-statistical",
data : {action: "get_data"},
success: function(response) {
alert(response);
data= response.data;
}
});
}
Now I want to parse few data(eg:local_new_cases,update_date_time,local_total_cases,local_deaths,local_recovered) from API, into html code. How to do that? please help me to save my life.Thank you.