API inject in AJAX page

First attempt, not fully tested.