How to convert a web app to use AJAX using D4PHP