There are some instant answers that use two (even more!) API calls. Take a look at the Dictionary Spice.
Trailers.pm (first call sends JSON to browser) -> browser (front-end uses $.getJSON or $.getScript to fetch the data from the other endpoint) -> TrailersVideo.pm (return the second JSON result) -> browser (now we call Spice.render(...))
Grep for $.getScript for examples in the repository. Tell me if you need any help with that!