Replace getPageDetails calls with an on function to retrieve the page trails.