finally got AJAX working, needs thorough testing next. . .