Hello,
looking for some assistance…I have a page set within a wordpress site that is pulling in the Top Participants. Of which, is working great! But now, I am looking to link each participant to their corresponding individual TeamRaiser pages. Here is the code I currently have set up…
<html>
<head></head>
<body>
<div id="top-fundraisers"> />
<script>
// Set up our HTTP request
var xhr = new XMLHttpRequest();
// Setup our listener to process completed requests
xhr.onload = function () {
// Process our return data
if (xhr.status >= 200 && xhr.status < 300) {
// What do when the request is successful
console.log('success!', xhr);
var container = document.getElementById("top-fundraisers");
var response = JSON.parse(xhr.responseText);
for (var count in response.getTopParticipantsDataResponse.teamraiserData) {
var participant = response.getTopParticipantsDataResponse.teamraiserData[count];
container.innerHTML += participant.name;
container.innerHTML += " - ";
container.innerHTML += participant.total;
container.innerHTML += "<br/>";
}
} else {
// What do when the request fails
console.log('The request failed!');
}
// Code that should run regardless of the request status
console.log('This always runs...');
};
// Create and send a request
var URL = "https://[CODE]/site/CRTeamraiserAPI?";
URL += "method=getTopParticipantsData";
URL += "&api_key=API KEY";
URL += "&v=1.0";
URL += "&response_format=json";
URL += "&fr_id=1740";
xhr.open('POST', URL);
xhr.send();
</script>
</body>
</html>
Assuming, the current method “TopParticipantsData” offers the requested ability.
Thank you in advanced!!