My NodeJS Code. I am getting correct result in console but page is not redirected to listings page
function displayCities(cname) {
var pageData = {
title: "Listings",
cities: null
};
axios(
//the request
{
url: "https://sandbox.repliers.io/listings?city=" + cname,
method: "GET",
headers: {
'Content-Type': 'application/json',
'REPLIERS-API-KEY': 'SKoKOGhEO42QzdkZ1cowKgLGm2mwm4'
}
}
).then(function (response){
//on success do stuff
console.log(response.data);
pageData.cities = response.data; //store JSON results in pageData.cities (previously null)
res.render("listings", pageData);
}).catch(function (error){
console.log(error);
});
}
displayCitiesis being called?? In this code, the definition forrescan't be seen anywhere.