The eventual solution to this issue should be to return a JSON blob to the browser that contains all of the search results. Then the JS script that controls the play previews just needs to have access to the file and lookup the relevant track details (e.g. mp3 link) to populate on the HTML page.