Base work for AJAX

Most of the setup for AJAX is complete. Now the nitty gritty stuff.