add AJAX code for generating pages for trials.