// app.js
var htmlTarget = document.querySelector("#target");
var resultDiv1 = document.createElement("div");
SprinklrTest.Send(new SprinklrTest.ReviewListRequest({
ItemsPerPage: 5,
OneBasedOnPage: 2,
Sort: "TimeStampAscending"
}), function callback(responseData) {
console.log("ima result", responseData)
// in the callback function we accept the returned val from request and we pass in a results variable to hold the response
// inspect this response data you get back an array of objects. you will need to go iterate through array and print out users
// console.log("these are the results for search" + results);
//next you need to manipulate the response data to get on screean
//this way will return an array that is then joined in a string seperated by two line breaks
// resultDiv1.innerHTML = responseData.Items.map(function(item) {
// var answer = [];
// answer.push("Title:" + item.Title, "Name:" + item.Owner.Name, "Body:" + item.Body);
// // console.log(answer.join(" ------------"));
// return answer.join("
");
// }).join("
");
// htmlTarget.appendChild(resultDiv1);
// this way for each item in the responseData.Items
// make a new empty div and put what you want inside then append to the end of the target
responseData.Items.forEach(function(item) {
var answer = [];
var div = document.createElement("div");
answer.push("Title:" + item.Title, "Name:" + item.Owner.Name, "Body:" + item.Body);
console.log(answer.join("\n"));
div.innerHTML = answer.join("
");
htmlTarget.appendChild(div);
});
});